Moo::Role - Online Linux Manual PageSection : 3pm
Updated : 2020-11-27
Source : perl v5.32.0
Note : User Contributed Perl Documentation

NAMEMoo::Role − Minimal Object Orientation support for Roles

SYNOPSIS​ package My::Role; ​ ​ use Moo::Role; ​ use strictures 2; ​ ​ sub foo { ... } ​ ​ sub bar { ... } ​ ​ has baz => ( ​ is => 'ro', ​ ); ​ ​ 1; And elsewhere: ​ package Some::Class; ​ ​ use Moo; ​ use strictures 2; ​ ​ # bar gets imported, but not foo ​ with 'My::Role'; ​ ​ sub foo { ... } ​ ​ 1;

DESCRIPTIONMoo::Role builds upon Role::Tiny, so look there for most of the documentation on how this works (in particular, using Moo::Role also enables strict and warnings). The main addition here is extra bits to make the roles more Moosey; which is to say, it adds has.

IMPORTED SUBROUTINESSee IMPORTED SUBROUTINES in Role::Tiny for all the other subroutines that are imported by this module.

has​ has attr => ( ​ is => 'ro', ​ ); Declares an attribute for the class to be composed into. See ​has in Moo for all options.

CLEANING UP IMPORTSMoo::Role cleans up its own imported methods and any imports declared before the use Moo::Role statement automatically. Anything imported after use Moo::Role will be composed into consuming packages. A package that consumes this role: ​ package My::Role::ID; ​ ​ use Digest::MD5 qw(md5_hex); ​ use Moo::Role; ​ use Digest::SHA qw(sha1_hex); ​ ​ requires 'name'; ​ ​ sub as_md5 { my ($self) = @_; return md5_hex($self−>name); } ​ sub as_sha1 { my ($self) = @_; return sha1_hex($self−>name); } ​ ​ 1; ​..will now have a $self−>sha1_hex() method available to it that probably does not do what you expect. On the other hand, a call to $self−>md5_hex() will die with the helpful error message: ​Can't locate object method "md5_hex". See CLEANING UP IMPORTS in Moo for more details.

SUPPORTSee Moo for support and contact information.

AUTHORSSee Moo for authors.

COPYRIGHT AND LICENSESee Moo for the copyright and license.
0
Johanes Gumabo
Data Size   :   8,248 byte
man-Moo::Role.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 170,791
Visitor ID   :     :  
Visitor IP   :   18.219.107.243   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Moo::Role.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Moo::Role.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|Moo::Role.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Moo::Role.3pm|43|'br══─}─══ |'br══─}─══ )