Moose::Meta::Class - The Moose metaclass
This is a subclass of Class::MOP::Class with Moose specific extensions.
For the most part, the only time you will ever encounter an instance of this class is if you are doing some serious deep introspection. To really understand this class, you need to refer to the Class::MOP::Class documentation.
Overrides original to accept a list of roles to apply to the created class.
my $metaclass = Moose::Meta::Class->create( 'New::Class', roles => [...] );
Overrides original to support roles and caching.
my $metaclass = Moose::Meta::Class->create_anon_class( superclasses => ['Foo'], roles => [qw/Some Roles Go Here/], cache => 1, );
Override original to add default options for inlining destructor and altering the Constructor metaclass.
Override original to lock add_role and memoize calculate_all_roles
add_role
calculate_all_roles
We override this method to support the trigger attribute option.
trigger
This provides some Moose specific extensions to this method, you almost never call this method directly unless you really know what you are doing.
This method makes sure to handle the moose weak-ref, type-constraint and type coercion features.
This accommodates Moose::Meta::Role::Method instances, which are aliased, instead of added, but still need to be counted as valid methods.
This will create an override method modifier for you, and install it in the package.
override
This will create an augment method modifier for you, and install it in the package.
augment
This will return an array of Moose::Meta::Role instances which are attached to this class.
Moose::Meta::Role
This takes an instance of Moose::Meta::Role in $role, and adds it to the list of associated roles.
$role
This will test if this class does a given $role_name. It will not only check it's local roles, but ask them as well in order to cascade down the role hierarchy.
does
$role_name
This will test if this class excludes a given $role_name. It will not only check it's local roles, but ask them as well in order to cascade down the role hierarchy.
excludes
This method does the same thing as Class::MOP::Class::add_attribute, but adds support for taking the $params as a HASH ref.
$params
These are the names of classes used when making a class immutable. These default to Moose::Meta::Method::Constructor and Moose::Meta::Method::Destructor respectively. These accessors are read-write, so you can use them to change the class name.
The name of the class used to throw errors. This default to Moose::Error::Default, which generates an error with a stacktrace just like Carp::confess.
Carp::confess
Moose overrides this method from Class::MOP::Class and attempts to fix some incompatibilities before doing the check.
Class::MOP::Class
Throws the error created by create_error using raise_error
create_error
raise_error
Creates an error message or object.
The default behavior is create_error_confess.
create_error_confess
If error_class is set uses create_error_object. Otherwise uses error_builder (a code reference or variant name), and calls the appropriate create_error_$builder method.
error_class
create_error_object
error_builder
create_error_$builder
Get or set the error builder. Defaults to confess.
confess
Get or set the error class. This defaults to Moose::Error::Default.
Creates an error using "longmess" in Carp
Creates an error using "shortmess" in Carp
Calls new on the class parameter in %args. Usable with error_class to support custom error objects for your meta class.
new
class
%args
Dies with an error object or string.
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
Stevan Little <stevan@iinteractive.com>
Copyright 2006-2009 by Infinity Interactive, Inc.
http://www.iinteractive.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Moose, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moose
CPAN shell
perl -MCPAN -e shell install Moose
For more information on module installation, please visit the detailed CPAN module installation guide.