-
-
07 Nov 2021 03:41:58 UTC
- Distribution: Moose
- Module version: 2.2201
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (71)
- Testers (2621 / 3 / 1)
- Kwalitee
Bus factor: 3- 92.11% Coverage
- License: perl_5
- Perl: v5.8.3
- Activity
24 month- Tools
- Download (881.54KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 142 contributors-
Stevan Little
-
Dave Rolsky
-
Jesse Luehrs
-
Shawn M Moore
-
יובל קוג'מן (Yuval Kogman)
-
Florian Ragwitz
-
Hans Dieter Pearcey
-
Chris Prather
-
Matt S Trout
-
Upasana Shukla
-
Graham Knop
-
Tomas Doran
-
Ricardo Signes
-
Guillermo Roditi
-
John Napiorkowski
-
Aankhen
-
Todd Hepler
-
Jonathan Rockway
-
Gerda Shank
-
Perlover
-
Shlomi Fish
-
Brad Bowman
-
Justin Hunter
-
Kent Fredric
-
Paul Driver
-
Anders Nor Berle
-
Brian Manning
-
gfx
-
Jay Hannah
-
Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
-
Leon Brocard
-
Olivier Mengué
-
Rafael Kitover
-
Christian Hansen
-
Cory Watson
-
Dagfinn Ilmari Mannsåker
-
Paul Jamieson Fenwick
-
Robert Buels
-
Dan Dascalescu
-
Marcel Grünauer
-
Scott McWhirter
-
Ævar Arnfjörð Bjarmason
-
Daisuke Maki (lestrrat)
-
Dylan William Hardison
-
Patrick Donelan
-
Stefan O'Rear
-
Tokuhiro Matsuno
-
Ash Berlin
-
Chris Weyl
-
Eric Wilhelm
-
Jess Robinson
-
Marc Mims
-
Marcus Ramberg
-
Mark Allen
-
Mateu X Hunter
-
matthof
-
Robert 'phaylon' Sedlacek
-
Zachary Lome
-
Aran Clary Deltac
-
Chip
-
Christopher J. Madsen
-
Curtis Jewell
-
Evan Carroll
-
Mark A. Stratman
-
Mark Fowler
-
Matthew Horsfall
-
mauke
-
Michael LaGrasta
-
Michael Rykov
-
Mike Whitaker
-
Moritz Onken
-
Nelo Onyiah
-
Nick Perez
-
Robert Boone
-
Robin V
-
rodrigolive
-
shelling
-
Thomas Sibley
-
Tom Hukins
-
Wallace Reis
-
Aaron Cohen
-
Adam J. Foxson
-
Adam Kennedy
-
Andy Jack
-
Anirvan Chatterjee
-
Ansgar Burchardt
-
A. Sinan Unur
-
Ben Hutton
-
Brendan Byrd
-
Chad Granum
-
Chankey Pathak
-
Chia-liang Kao
-
Christian Walde (Mithaldu)
-
chromatic
-
Dann
-
Dave Romano
-
David Leadbeater
-
David Steinbrunner
-
dmaestro
-
E. Choroba
-
franck cuny
-
Frew Schmidt
-
gregor herrmann
-
hakim
-
Henry Van Styn
-
James Marca
-
Jason May
-
Jay Allen
-
Jay Kuri
-
Jeff Bisbee
-
Jens Berthold
-
Jesse Vincent
-
joel
-
John Douglas Porter
-
John Goulah
-
Justin DeVuyst
-
Kang-min Liu
-
Leon Timmermans
-
Mark O Grady
-
Matt Kraai
-
Michael Schout
-
Nathan Gray
-
Olaf Alders
-
Olof Johansson
-
Paul Cochrane
-
Paweł Murias
-
Pedro Melo
-
Peter Shangov
-
Philippe Bruhat (BooK)
-
Philipp Gortan
-
Phillip Smith
-
Piotr Roszatycki
-
pktm
-
rouzier
-
Sam Vilain
-
sherrardb
-
Simon Reinhardt
-
sue spence
-
Tuomas Jormola
-
wickline
-
Yanick Champoux
-
Zoffix Znet
- Dependencies
- Carp
- Class::Load
- Class::Load::XS
- Data::OptList
- Devel::GlobalDestruction
- Devel::OverloadInfo
- Devel::StackTrace
- Dist::CheckConflicts
- Eval::Closure
- List::Util
- MRO::Compat
- Module::Runtime
- Module::Runtime::Conflicts
- Package::DeprecationManager
- Package::Stash
- Package::Stash::XS
- Params::Util
- Scalar::Util
- Sub::Exporter
- Sub::Util
- Try::Tiny
- parent
- strict
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- VERSION
- DESCRIPTION
- INHERITANCE
- METHODS
- Construction
- Role application
- Roles and other roles
- Methods
- Attributes
- Overload introspection and creation
- Required methods
- Method modifiers
- $metarole->add_after_method_modifier($method_name, $method)
- $metarole->add_around_method_modifier($method_name, $method)
- $metarole->add_before_method_modifier($method_name, $method)
- $metarole->add_override_method_modifier($method_name, $method)
- $metarole->has_after_method_modifiers
- $metarole->has_around_method_modifiers
- $metarole->has_before_method_modifiers
- $metarole->has_override_method_modifier
- $metarole->get_after_method_modifiers($method_name)
- $metarole->get_around_method_modifiers($method_name)
- $metarole->get_before_method_modifiers($method_name)
- $metarole->get_override_method_modifier($method_name)
- Introspection
- BUGS
- AUTHORS
- COPYRIGHT AND LICENSE
NAME
Moose::Meta::Role - The Moose Role metaclass
VERSION
version 2.2201
DESCRIPTION
This class is a subclass of Class::MOP::Module that provides additional Moose-specific functionality.
Its API looks a lot like Moose::Meta::Class, but internally it implements many things differently. This may change in the future.
INHERITANCE
Moose::Meta::Role
is a subclass of Class::MOP::Module.METHODS
Construction
Moose::Meta::Role->initialize($role_name)
This method creates a new role object with the provided name.
Moose::Meta::Role->combine( [ $role => { ... } ], [ $role ], ... )
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
-excludes
and-alias
keys to control how methods are composed from the role.The return value is a new Moose::Meta::Role::Composite that represents the combined roles.
$metarole->composition_class_roles
When combining multiple roles using
combine
, this method is used to obtain a list of role names to be applied to the Moose::Meta::Role::Composite instance returned bycombine
. The default implementation returns an empty list. Extensions that need to hook into role combination may wrap this method to return additional role names.Moose::Meta::Role->create($name, %options)
This method is identical to the Moose::Meta::Class
create
method.Moose::Meta::Role->create_anon_role
This method is identical to the Moose::Meta::Class
create_anon_class
method.$metarole->is_anon_role
Returns true if the role is an anonymous role.
$metarole->consumers
Returns a list of names of classes and roles which consume this role.
Role application
$metarole->apply( $thing, @options )
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.The options are passed directly to the constructor for the appropriate Moose::Meta::Role::Application subclass.
Note that this will apply the role even if the
$thing
in question alreadydoes
this role. "does_role" in Moose::Util is a convenient wrapper for finding out if role application is necessary.Roles and other roles
$metarole->get_roles
This returns an array reference of roles which this role does. This list may include duplicates.
$metarole->calculate_all_roles
This returns a unique list of all roles that this role does, and all the roles that its roles do.
$metarole->does_role($role)
Given a role name or Moose::Meta::Role object, returns true if this role does the given role.
$metarole->add_role($role)
Given a Moose::Meta::Role object, this adds the role to the list of roles that the role does.
$metarole->get_excluded_roles_list
Returns a list of role names which this role excludes.
$metarole->excludes_role($role_name)
Given a role name, returns true if this role excludes the named role.
$metarole->add_excluded_roles(@role_names)
Given one or more role names, adds those roles to the list of excluded roles.
Methods
The methods for dealing with a role's methods are all identical in API and behavior to the same methods in Class::MOP::Class.
$metarole->method_metaclass
Returns the method metaclass name for the role. This defaults to Moose::Meta::Role::Method.
$metarole->get_method($name)
$metarole->has_method($name)
$metarole->add_method( $name, $body )
$metarole->get_method_list
$metarole->find_method_by_name($name)
These methods are all identical to the methods of the same name in Class::MOP::Package
Attributes
As with methods, the methods for dealing with a role's attribute are all identical in API and behavior to the same methods in Class::MOP::Class.
However, attributes stored in this class are not 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's
add_attribute
method.This is quite likely to change in the future.
$metarole->get_attribute($attribute_name)
$metarole->has_attribute($attribute_name)
$metarole->get_attribute_list
$metarole->add_attribute($name, %options)
$metarole->remove_attribute($attribute_name)
Overload introspection and creation
The methods for dealing with a role's overloads are all identical in API and behavior to the same methods in Class::MOP::Class.
$metarole->is_overloaded
$metarole->get_overloaded_operator($op)
$metarole->has_overloaded_operator($op)
$metarole->get_overload_list
$metarole->get_all_overloaded_operators
$metarole->add_overloaded_operator($op, $impl)
$metarole->remove_overloaded_operator($op)
Required methods
$metarole->get_required_method_list
Returns the list of methods required by the role.
$metarole->requires_method($name)
Returns true if the role requires the named method.
$metarole->add_required_methods(@names)
Adds the named methods to the role's list of required methods.
$metarole->remove_required_methods(@names)
Removes the named methods from the role's list of required methods.
$metarole->add_conflicting_method(%params)
Instantiate the parameters as a Moose::Meta::Role::Method::Conflicting object, then add it to the required method list.
Method modifiers
These methods act like their counterparts in Class::MOP::Class and Moose::Meta::Class.
However, method modifiers are simply stored internally, and are not applied until the role itself is applied to a class or object.
$metarole->add_after_method_modifier($method_name, $method)
$metarole->add_around_method_modifier($method_name, $method)
$metarole->add_before_method_modifier($method_name, $method)
$metarole->add_override_method_modifier($method_name, $method)
These methods all add an appropriate modifier to the internal list of modifiers.
$metarole->has_after_method_modifiers
$metarole->has_around_method_modifiers
$metarole->has_before_method_modifiers
$metarole->has_override_method_modifier
Return true if the role has any modifiers of the given type.
$metarole->get_after_method_modifiers($method_name)
$metarole->get_around_method_modifiers($method_name)
$metarole->get_before_method_modifiers($method_name)
Given a method name, returns a list of the appropriate modifiers for that method.
$metarole->get_override_method_modifier($method_name)
Given a method name, returns the override method modifier for that method, if it has one.
Introspection
Moose::Meta::Role->meta
This will return a Class::MOP::Class instance for this class.
BUGS
See "BUGS" in Moose for details on reporting bugs.
AUTHORS
Stevan Little <stevan@cpan.org>
Dave Rolsky <autarch@urth.org>
Jesse Luehrs <doy@cpan.org>
Shawn M Moore <sartak@cpan.org>
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
Karen Etheridge <ether@cpan.org>
Florian Ragwitz <rafl@debian.org>
Hans Dieter Pearcey <hdp@cpan.org>
Chris Prather <chris@prather.org>
Matt S Trout <mstrout@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2006 by Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install Moose, copy and paste the appropriate command in to your terminal.
cpanm Moose
perl -MCPAN -e shell install Moose
For more information on module installation, please visit the detailed CPAN module installation guide.