Programming with Moose/Syntax/extends

Use the   keyword to clobber the inheritance chain setting only that which you've specified. Extends both eliminates and causes problems and should be used often, but with caution when migrating from Non-Moose to Moose.

Gotcha
One thing to look out for when using  is the use of. The CORE module "base" does not clobber (overwrite) the inheritance chain but instead adds to it. Steven the author of Moose identified this as a problem area, even though functionality some times depends on the "problem." Extends forces a linear unless otherwise specified inheritance chain, this means the last module in the chain by definition must either, or. If either of these citera are not met you will get obfuscated errors informing you the keywords (plain Perl5 functions) are not defined.

The directive to  instructs Moose to automagically set up   to inherit from. is clobbered with the use of.

Example
module A - module B - module C


 * 1) A extends B
 * 2) B extends C
 * 3) C must either   or

Class::Accessor
Often the culprit of  problems is , or legacy junk as the Moose team refers to it. is often used in base classes as in the following

This has the result of pushing onto  (the inheritance chain)   but it still leaves Moose out of the picture. Moose expects  to be at the base of the inheritance chain.