1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.3
4 .\" ========================================================================
5 .de Sh \" Subsection heading
13 .de Sp \" Vertical space (when we can't use .PP)
17 .de Vb \" Begin verbatim text
22 .de Ve \" End verbatim text
26 .\" Set up some character translations and predefined strings. \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote. | will give a
29 .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
37 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD. Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
57 . tm Index:\\$1\t\\n%\t"\\$2"
63 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear. Run. Save yourself. No user-serviceable parts.
70 . \" fudge factors for nroff and troff
79 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
85 . \" simple accents for nroff and troff
95 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
102 . \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 . \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 . \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
129 .\" ========================================================================
131 .IX Title "Moose::Meta::Class 3"
132 .TH Moose::Meta::Class 3 "2009-11-19" "perl v5.8.7" "User Contributed Perl Documentation"
134 Moose::Meta::Class \- The Moose metaclass
136 .IX Header "DESCRIPTION"
137 This class is a subclass of Class::MOP::Class that provides
138 additional Moose-specific functionality.
140 To really understand this class, you will need to start with the
141 Class::MOP::Class documentation. This class can be understood as a
142 set of additional features on top of the basic feature provided by
145 .IX Header "INHERITANCE"
146 \&\f(CW\*(C`Moose::Meta::Class\*(C'\fR is a subclass of Class::MOP::Class.
149 .ie n .IP "\fBMoose::Meta::Class\->initialize($package_name, \fB%options\fB)\fR" 4
150 .el .IP "\fBMoose::Meta::Class\->initialize($package_name, \f(CB%options\fB)\fR" 4
151 .IX Item "Moose::Meta::Class->initialize($package_name, %options)"
152 This overrides the parent's method in order to provide its own
153 defaults for the \f(CW\*(C`attribute_metaclass\*(C'\fR, \f(CW\*(C`instance_metaclass\*(C'\fR, and
154 \&\f(CW\*(C`method_metaclass\*(C'\fR options.
156 These all default to the appropriate Moose class.
157 .ie n .IP "\fBMoose::Meta::Class\->create($package_name, \fB%options\fB)\fR" 4
158 .el .IP "\fBMoose::Meta::Class\->create($package_name, \f(CB%options\fB)\fR" 4
159 .IX Item "Moose::Meta::Class->create($package_name, %options)"
160 This overrides the parent's method in order to accept a \f(CW\*(C`roles\*(C'\fR
161 option. This should be an array reference containing roles
162 that the class does, each optionally followed by a hashref of options
163 (\f(CW\*(C`\-excludes\*(C'\fR and \f(CW\*(C`\-alias\*(C'\fR).
166 \& my $metaclass = Moose::Meta::Class\->create( 'New::Class', roles => [...] );
168 .IP "\fBMoose::Meta::Class\->create_anon_class\fR" 4
169 .IX Item "Moose::Meta::Class->create_anon_class"
170 This overrides the parent's method to accept a \f(CW\*(C`roles\*(C'\fR option, just
171 as \f(CW\*(C`create\*(C'\fR does.
173 It also accepts a \f(CW\*(C`cache\*(C'\fR option. If this is true, then the anonymous
174 class will be cached based on its superclasses and roles. If an
175 existing anonymous class in the cache has the same superclasses and
176 roles, it will be reused.
179 \& my $metaclass = Moose::Meta::Class\->create_anon_class(
180 \& superclasses => ['Foo'],
181 \& roles => [qw/Some Roles Go Here/],
185 .IP "\fB$metaclass\->make_immutable(%options)\fR" 4
186 .IX Item "$metaclass->make_immutable(%options)"
187 This overrides the parent's method to add a few options. Specifically,
188 it uses the Moose-specific constructor and destructor classes, and
189 enables inlining the destructor.
191 Also, since Moose always inlines attributes, it sets the
192 \&\f(CW\*(C`inline_accessors\*(C'\fR option to false.
193 .IP "\fB$metaclass\->new_object(%params)\fR" 4
194 .IX Item "$metaclass->new_object(%params)"
195 This overrides the parent's method in order to add support for
197 .ie n .IP "\fB$metaclass\->add_override_method_modifier($name, \fB$sub\fB)\fR" 4
198 .el .IP "\fB$metaclass\->add_override_method_modifier($name, \f(CB$sub\fB)\fR" 4
199 .IX Item "$metaclass->add_override_method_modifier($name, $sub)"
200 This adds an \f(CW\*(C`override\*(C'\fR method modifier to the package.
201 .ie n .IP "\fB$metaclass\->add_augment_method_modifier($name, \fB$sub\fB)\fR" 4
202 .el .IP "\fB$metaclass\->add_augment_method_modifier($name, \f(CB$sub\fB)\fR" 4
203 .IX Item "$metaclass->add_augment_method_modifier($name, $sub)"
204 This adds an \f(CW\*(C`augment\*(C'\fR method modifier to the package.
205 .IP "\fB$metaclass\->calculate_all_roles\fR" 4
206 .IX Item "$metaclass->calculate_all_roles"
207 This will return a unique array of \f(CW\*(C`Moose::Meta::Role\*(C'\fR instances
208 which are attached to this class.
209 .IP "\fB$metaclass\->add_role($role)\fR" 4
210 .IX Item "$metaclass->add_role($role)"
211 This takes a Moose::Meta::Role object, and adds it to the class's
212 list of roles. This \fIdoes not\fR actually apply the role to the class.
213 .IP "\fB$metaclass\->role_applications\fR" 4
214 .IX Item "$metaclass->role_applications"
215 Returns a list of Moose::Meta::Role::Application::ToClass
216 objects, which contain the arguments to role application.
217 .IP "\fB$metaclass\->add_role_application($application)\fR" 4
218 .IX Item "$metaclass->add_role_application($application)"
219 This takes a Moose::Meta::Role::Application::ToClass object, and
220 adds it to the class's list of role applications. This \fIdoes not\fR
221 actually apply any role to the class; it is only for tracking role
223 .IP "\fB$metaclass\->does_role($role_name)\fR" 4
224 .IX Item "$metaclass->does_role($role_name)"
225 This returns a boolean indicating whether or not the class does the
226 specified role. This tests both the class and its parents.
227 .IP "\fB$metaclass\->excludes_role($role_name)\fR" 4
228 .IX Item "$metaclass->excludes_role($role_name)"
229 A class excludes a role if it has already composed a role which
230 excludes the named role. This tests both the class and its parents.
231 .ie n .IP "\fB$metaclass\->add_attribute($attr_name, \fB%params\fB|$params)\fR" 4
232 .el .IP "\fB$metaclass\->add_attribute($attr_name, \f(CB%params\fB|$params)\fR" 4
233 .IX Item "$metaclass->add_attribute($attr_name, %params|$params)"
234 This overrides the parent's method in order to allow the parameters to
235 be provided as a hash reference.
236 .IP "\fB$metaclass\->constructor_class ($class_name)\fR" 4
237 .IX Item "$metaclass->constructor_class ($class_name)"
239 .IP "\fB$metaclass\->destructor_class ($class_name)\fR" 4
240 .IX Item "$metaclass->destructor_class ($class_name)"
242 These are the names of classes used when making a class
243 immutable. These default to Moose::Meta::Method::Constructor and
244 Moose::Meta::Method::Destructor respectively. These accessors are
245 read\-write, so you can use them to change the class name.
246 .IP "\fB$metaclass\->error_class($class_name)\fR" 4
247 .IX Item "$metaclass->error_class($class_name)"
248 The name of the class used to throw errors. This defaults to
249 Moose::Error::Default, which generates an error with a stacktrace
250 just like \f(CW\*(C`Carp::confess\*(C'\fR.
251 .ie n .IP "\fB$metaclass\->throw_error($message, \fB%extra\fB)\fR" 4
252 .el .IP "\fB$metaclass\->throw_error($message, \f(CB%extra\fB)\fR" 4
253 .IX Item "$metaclass->throw_error($message, %extra)"
254 Throws the error created by \f(CW\*(C`create_error\*(C'\fR using \f(CW\*(C`raise_error\*(C'\fR
257 All complex software has bugs lurking in it, and this module is no
258 exception. If you find a bug please either email me, or add the bug
262 Stevan Little <stevan@iinteractive.com>
263 .SH "COPYRIGHT AND LICENSE"
264 .IX Header "COPYRIGHT AND LICENSE"
265 Copyright 2006\-2009 by Infinity Interactive, Inc.
267 <http://www.iinteractive.com>
269 This library is free software; you can redistribute it and/or modify
270 it under the same terms as Perl itself.