A Super-fast crash course in Moose for those working from the old OO Perl way of doing things.

  1. Moose creates the constructor for you. If you want to do 'creation / initialization' of your object, you want to create a sub BUILD - which runs after the arguments to the new are processed (and any defaults are set)
  2. There are both multiple class inheritance and Roles in Moose.
  3. Roles are somewhat like 'packaged attributes/methods' that can be added to any other object / class regardless of it's superclass hierarchy. They are different from a class in that they basically define that a class using them 'does something' rather than the class 'is something'

More to come. Write your questions, we'll add answers.

Moje tagi:
 
Popularne tagi:
 
Powered by Catalyst