Moo::Role - Minimal Object Orientation support for Roles
package My::Role; use Moo::Role; sub foo { ... } sub bar { ... } has baz => ( is => 'ro', ); 1;
And elsewhere:
package Some::Class; use Moo; # bar gets imported, but not foo with('My::Role'); sub foo { ... } 1;
Moo::Role builds upon Role::Tiny, so look there for most of the documentation on how this works. The main addition here is extra bits to make the roles more "Moosey;" which is to say, it adds "has".
Moo::Role
See "IMPORTED SUBROUTINES" in Role::Tiny for all the other subroutines that are imported by this module.
has attr => ( is => 'ro', );
Declares an attribute for the class to be composed into. See "has" in Moo for all options.
See Moo for authors.
See Moo for the copyright and license.
To install Moo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moo
CPAN shell
perl -MCPAN -e shell install Moo
For more information on module installation, please visit the detailed CPAN module installation guide.