{"id":6798,"date":"2022-12-20T19:33:39","date_gmt":"2022-12-20T22:33:39","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/moosemetarole-man3\/"},"modified":"2022-12-20T19:33:39","modified_gmt":"2022-12-20T22:33:39","slug":"moosemetarole-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/moosemetarole-man3\/","title":{"rendered":"Moose::Meta::Role (man3)"},"content":{"rendered":"<h1 align=\"center\">Moose::Meta::Role<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#INHERITANCE\">INHERITANCE<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#AUTHORS\">AUTHORS<\/a><br \/> <a href=\"#COPYRIGHT AND LICENSE\">COPYRIGHT AND LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Moose::Meta::Role \u2212 The Moose Role metaclass<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">version 2.2014<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This class is a subclass of Class::MOP::Module that provides additional Moose-specific functionality.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Its <small>API<\/small> looks a lot like Moose::Meta::Class, but internally it implements many things differently. This may change in the future.<\/p>\n<h2>INHERITANCE <a name=\"INHERITANCE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">&#8220;Moose::Meta::Role&#8221; is a subclass of Class::MOP::Module.<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Construction<\/b> <i><br \/> Moose::Meta::Role\u2212>initialize($role_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This method creates a new role object with the provided name.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>Moose::Meta::Role\u2212>combine( [ $role => { &#8230; } ], [ $role ], &#8230; )<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This method accepts a list of array references. Each array reference should contain a role name or Moose::Meta::Role object as its first element. The second element is an optional hash reference. The hash reference can contain &#8220;\u2212excludes&#8221; and &#8220;\u2212alias&#8221; keys to control how methods are composed from the role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The return value is a new Moose::Meta::Role::Composite that represents the combined roles.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>composition_class_roles<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">When combining multiple roles using &#8220;combine&#8221;, this method is used to obtain a list of role names to be applied to the Moose::Meta::Role::Composite instance returned by &#8220;combine&#8221;. The default implementation returns an empty list. Extensions that need to hook into role combination may wrap this method to return additional role names.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>Moose::Meta::Role\u2212>create($name, %options)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This method is identical to the Moose::Meta::Class &#8220;create&#8221; method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>Moose::Meta::Role\u2212>create_anon_role<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This method is identical to the Moose::Meta::Class &#8220;create_anon_class&#8221; method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>is_anon_role<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns true if the role is an anonymous role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>consumers<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns a list of names of classes and roles which consume this role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Role application<\/b> <i><br \/> $metarole\u2212>apply( $thing, @options )<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This method applies a role to the given $thing. That can be another Moose::Meta::Role, object, a Moose::Meta::Class object, or a (non-meta) object instance.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The options are passed directly to the constructor for the appropriate Moose::Meta::Role::Application subclass.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Note that this will apply the role even if the $thing in question already &#8220;does&#8221; this role. &#8220;does_role&#8221; in Moose::Util is a convenient wrapper for finding out if role application is necessary.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Roles and other roles<\/b> <i><br \/> $metarole\u2212>get_roles<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This returns an array reference of roles which this role does. This list may include duplicates.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>calculate_all_roles<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This returns a <i>unique<\/i> list of all roles that this role does, and all the roles that its roles do.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>does_role($role)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given a role <i>name<\/i> or Moose::Meta::Role object, returns true if this role does the given role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_role($role)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given a Moose::Meta::Role object, this adds the role to the list of roles that the role does.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_excluded_roles_list<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns a list of role names which this role excludes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>excludes_role($role_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given a role <i>name<\/i>, returns true if this role excludes the named role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_excluded_roles(@role_names)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given one or more role names, adds those roles to the list of excluded roles.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Methods<\/b> <br \/> The methods for dealing with a role\u2019s methods are all identical in <small>API<\/small> and behavior to the same methods in Class::MOP::Class.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>method_metaclass<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns the method metaclass name for the role. This defaults to Moose::Meta::Role::Method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_method($name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_method($name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_method( $name, $body )<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_method_list<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>find_method_by_name($name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">These methods are all identical to the methods of the same name in Class::MOP::Package<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Attributes<\/b> <br \/> As with methods, the methods for dealing with a role\u2019s attribute are all identical in <small>API<\/small> and behavior to the same methods in Class::MOP::Class.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">However, attributes stored in this class are <i>not<\/i> stored as objects. Rather, the attribute definition is stored as a hash reference. When a role is composed into a class, this hash reference is passed directly to the metaclass\u2019s &#8220;add_attribute&#8221; method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is quite likely to change in the future.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_attribute($attribute_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_attribute($attribute_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_attribute_list<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_attribute($name, %options)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>remove_attribute($attribute_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Overload introspection and creation<\/b> <br \/> The methods for dealing with a role\u2019s overloads are all identical in <small>API<\/small> and behavior to the same methods in Class::MOP::Class.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>is_overloaded<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_overloaded_operator($op)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_overloaded_operator($op)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_overload_list<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_all_overloaded_operators<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_overloaded_operator($op, $impl)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>remove_overloaded_operator($op)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Required methods<\/b> <i><br \/> $metarole\u2212>get_required_method_list<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns the list of methods required by the role.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>requires_method($name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Returns true if the role requires the named method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_required_methods(@names)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Adds the named methods to the role\u2019s list of required methods.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>remove_required_methods(@names)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Removes the named methods from the role\u2019s list of required methods.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_conflicting_method(%params)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Instantiate the parameters as a Moose::Meta::Role::Method::Conflicting object, then add it to the required method list.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Method modifiers<\/b> <br \/> These methods act like their counterparts in Class::MOP::Class and Moose::Meta::Class.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">However, method modifiers are simply stored internally, and are not applied until the role itself is applied to a class or object.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_after_method_modifier($method_name, $method)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_around_method_modifier($method_name, $method)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_before_method_modifier($method_name, $method)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>add_override_method_modifier($method_name, $method)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">These methods all add an appropriate modifier to the internal list of modifiers.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_after_method_modifiers<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_around_method_modifiers<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_before_method_modifiers<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>has_override_method_modifier<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Return true if the role has any modifiers of the given type.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_after_method_modifiers($method_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_around_method_modifiers($method_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_before_method_modifiers($method_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given a method name, returns a list of the appropriate modifiers for that method.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>$metarole\u2212>get_override_method_modifier($method_name)<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Given a method name, returns the override method modifier for that method, if it has one.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Introspection<\/b> <i><br \/> Moose::Meta::Role\u2212>meta<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This will return a Class::MOP::Class instance for this class.<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">See &#8221; <small>BUGS&#8221;<\/small> in Moose for details on reporting bugs.<\/p>\n<h2>AUTHORS <a name=\"AUTHORS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p style=\"margin-top: 1em\">Stevan Little <stevan@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Dave Rolsky <autarch@urth.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Jesse Luehrs <doy@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Shawn M Moore <sartak@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>\u00d7\u00d7\u00d7\u00d7 \u00d7\u00a7\u00d7\u00d7\u2019\u00d7\u00d7 (Yuval Kogman) <nothingmuch@woobling.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Karen Etheridge <ether@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Florian Ragwitz <rafl@debian.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Hans Dieter Pearcey <hdp@cpan.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Chris Prather <chris@prather.org><\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"83%\">\n<p>Matt S Trout <mstrout@cpan.org><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>COPYRIGHT AND LICENSE <a name=\"COPYRIGHT AND LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This software is copyright (c) 2006 by Infinity Interactive, Inc.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is free software; you can redistribute it and\/or modify it under the same terms as the Perl 5 programming language system itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Moose::Meta::Role \u2212 The Moose Role metaclass <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3166],"class_list":["post-6798","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-moosemetarole"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6798","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6798"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6798\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6798"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}