Moose::Cookbook::Snack::Keywords - Restricted keywords in Moose
There are several keywords exported in Moose that cause clashes against any barewords such as attribute names, sub names, and globs.
While most of the reserved keywords collisions can be avoided, however meta is the only one you cant override. Do not attempt to override meta.
If you are using Moose its best to avoid these keywords
If you are using Moose::Util::TypeConstraints its best to avoid these keywords
To remove the keywords Moose exports using no Moose at the bottom of your code
package Thing; use Moose; # code here no Moose;
The Sub::Exporter module can rename keywords
package LOL::Cat; use Moose 'has' => { -as => 'i_can_haz' }; i_can_haz 'cheeseburger' => ( is => 'rw', trigger => sub { print "NOM NOM" } ); LOL::Cat->new->cheeseburger('KTHNXBYE');;
You can use namespace::clean to clean up the namespace
John Goulah <jgoulah@cpan.org<gt>
<jgoulah@cpan.org<gt
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install Moose, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moose
CPAN shell
perl -MCPAN -e shell install Moose
For more information on module installation, please visit the detailed CPAN module installation guide.