{"id":6796,"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\/mooseutilmetarole-man3\/"},"modified":"2022-12-20T19:33:39","modified_gmt":"2022-12-20T22:33:39","slug":"mooseutilmetarole-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/mooseutilmetarole-man3\/","title":{"rendered":"Moose::Util::MetaRole (man3)"},"content":{"rendered":"<h1 align=\"center\">Moose::Util::MetaRole<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#VERSION\">VERSION<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#USAGE\">USAGE<\/a><br \/> <a href=\"#FUNCTIONS\">FUNCTIONS<\/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::Util::MetaRole \u2212 Apply roles to any metaclass, as well as the object base class<\/p>\n<h2>VERSION <a name=\"VERSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">version 2.2014<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">package MyApp::Moose; <br \/> use Moose (); <br \/> use Moose::Exporter; <br \/> use Moose::Util::MetaRole; <br \/> use MyApp::Role::Meta::Class; <br \/> use MyApp::Role::Meta::Method::Constructor; <br \/> use MyApp::Role::Object; <br \/> Moose::Exporter\u2212>setup_import_methods( also => &#8216;Moose&#8217; ); <br \/> sub init_meta { <br \/> shift; <br \/> my %args = @_; <br \/> Moose\u2212>init_meta(%args); <br \/> Moose::Util::MetaRole::apply_metaroles( <br \/> for => $args{for_class}, <br \/> class_metaroles => { <br \/> class => [&#8216;MyApp::Role::Meta::Class&#8217;], <br \/> constructor => [&#8216;MyApp::Role::Meta::Method::Constructor&#8217;], <br \/> }, <br \/> ); <br \/> Moose::Util::MetaRole::apply_base_class_roles( <br \/> for => $args{for_class}, <br \/> roles => [&#8216;MyApp::Role::Object&#8217;], <br \/> ); <br \/> return $args{for_class}\u2212>meta(); <br \/> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This utility module is designed to help authors of Moose extensions write extensions that are able to cooperate with other Moose extensions. To do this, you must write your extensions as roles, which can then be dynamically applied to the caller\u2019s metaclasses.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This module makes sure to preserve any existing superclasses and roles already set for the meta objects, which means that any number of extensions can apply roles in any order.<\/p>\n<h2>USAGE <a name=\"USAGE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The easiest way to use this module is through Moose::Exporter, which can generate the appropriate &#8220;init_meta&#8221; method for you, and make sure it is called when imported.<\/p>\n<h2>FUNCTIONS <a name=\"FUNCTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This module provides two functions.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>apply_metaroles( &#8230; )<\/b> <br \/> This function will apply roles to one or more metaclasses for the specified class. It will return a new metaclass object for the class or role passed in the &#8220;for&#8221; parameter.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">It accepts the following parameters:<\/p>\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>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"18%\">\n<p>for => $name<\/p>\n<\/td>\n<td width=\"65%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">This specifies the class or for which to alter the meta classes. This can be a package name, or an appropriate meta-object (a Moose::Meta::Class or Moose::Meta::Role).<\/p>\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=\"40%\">\n<p style=\"margin-top: 1em\">class_metaroles => %roles<\/p>\n<\/td>\n<td width=\"43%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">This is a hash reference specifying which metaroles will be applied to the class metaclass and its contained metaclasses and helper classes.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Each key should in turn point to an array reference of role names.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">It accepts the following keys:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"><\/td>\n<td width=\"8%\">\n<p style=\"margin-top: 1em\">class<\/p>\n<\/td>\n<td width=\"75%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">attribute<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"><\/td>\n<td width=\"9%\">\n<p>method<\/p>\n<\/td>\n<td width=\"74%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">wrapped_method <br \/> instance <br \/> constructor <br \/> destructor<\/p>\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=\"14%\">\n<p>error<\/p>\n<\/td>\n<td width=\"75%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"14%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"75%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">role_metaroles => %roles<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">This is a hash reference specifying which metaroles will be applied to the role metaclass and its contained metaclasses and helper classes.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">It accepts the following keys:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"><\/td>\n<td width=\"6%\">\n<p style=\"margin-top: 1em\">role<\/p>\n<\/td>\n<td width=\"77%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">attribute<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"17%\"><\/td>\n<td width=\"9%\">\n<p>method<\/p>\n<\/td>\n<td width=\"74%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">required_method <br \/> conflicting_method <br \/> application_to_class <br \/> application_to_role <br \/> application_to_instance <br \/> application_role_summation <br \/> applied_attribute<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>apply_base_class_roles( for => $class, roles => @roles )<\/b> <br \/> This function will apply the specified roles to the object\u2019s base 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::Util::MetaRole \u2212 Apply roles to any metaclass, as well as the object base class <\/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,3164],"class_list":["post-6796","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-mooseutilmetarole"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6796","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=6796"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6796\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}