Programming with Moose/Syntax
A big problem with the CPAN docs thus far is they utilize (abuse) the fact that Moose is an application of Class::MOP
. Class::MOP
is Meta Object Protocol building framework - and that is usually about where the cryptic confusion sets in.. There is a very blurry distinction between Class::MOP
and Moose, because Moose is the only known application of Class::MOP
.
Essentially what we have in Class::MOP
is an archive of hacks that allow Moose to be terse and non-pearlish. Moose makes a few of these hacks available with out much sugar but generally speaking candy coats them to a comfortable level.
In this syntax compendium of Moose we promise to never mention Class::MOP
again.[1]
Table of Contents
editKeywords exported with use Moose;
:
- has
- before, after, around
- blessed
- override
- augment
- extends
- with
- meta
- Other functions - Non-polluting fully-qualified syntax
Use of 'no Moose'
edit15:32 <@konobi> less shit to track during runtime
15:33 <@Sartak> EvanCarroll: my $person = Person->new; $person->has("jewelry")
15:33 <@konobi> just _having_ stuff in your namespace will slow the interpreter down
15:33 <@Sartak> if you keep Moose's functions in Person's namespace, that will have weird results
15:33 <@Sartak> if you no Moose, then it's the usual "undefined function" error
Footnotes
edit^ Class::MOP
, last time, I swear.