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 edit

Wikibook Development Stages
Sparse text   Developing text   Maturing text   Developed text   Comprehensive text  

Keywords exported with use Moose;:

  1. has  
  2. before, after, around  
  3. blessed
  4. override  
  5. augment
  6. extends  
  7. with
  8. meta
  9. Other functions - Non-polluting fully-qualified syntax  


Use of 'no Moose' edit

15: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.