Commit | Line | Data |
306290e8 |
1 | package Mouse::Meta::Class; |
bc76ed1c |
2 | use Mouse::Util qw/:meta/; # enables strict and warnings |
c3398f5b |
3 | |
1d76ae62 |
4 | use Scalar::Util (); |
6d28c5cf |
5 | |
6d28c5cf |
6 | use Mouse::Meta::Module; |
f3bb863f |
7 | our @ISA = qw(Mouse::Meta::Module); |
3a63a2e7 |
8 | |
3b48bcc8 |
9 | our @CARP_NOT = qw(Mouse); # trust Mouse |
10 | |
e058b279 |
11 | sub attribute_metaclass; |
d9659f80 |
12 | sub method_metaclass; |
3a63a2e7 |
13 | |
e058b279 |
14 | sub constructor_class; |
15 | sub destructor_class; |
380e1cd7 |
16 | |
d9659f80 |
17 | |
8e64d0fa |
18 | sub _construct_meta { |
88ed7189 |
19 | my($class, %args) = @_; |
c3398f5b |
20 | |
5132ec42 |
21 | $args{attributes} = {}; |
22 | $args{methods} = {}; |
23 | $args{roles} = []; |
8536d351 |
24 | |
c3398f5b |
25 | $args{superclasses} = do { |
26 | no strict 'refs'; |
88ed7189 |
27 | \@{ $args{package} . '::ISA' }; |
c3398f5b |
28 | }; |
29 | |
8d40c3b8 |
30 | my $self = bless \%args, ref($class) || $class; |
7eb3a8d5 |
31 | if(ref($self) ne __PACKAGE__){ |
9009aca1 |
32 | $self->meta->_initialize_object($self, \%args); |
8d40c3b8 |
33 | } |
34 | return $self; |
7a50b450 |
35 | } |
36 | |
37 | sub create_anon_class{ |
38 | my $self = shift; |
39 | return $self->create(undef, @_); |
40 | } |
41 | |
43165725 |
42 | sub is_anon_class; |
c3398f5b |
43 | |
43165725 |
44 | sub roles; |
c3398f5b |
45 | |
e7264861 |
46 | sub calculate_all_roles { |
47 | my $self = shift; |
48 | my %seen; |
49 | return grep { !$seen{ $_->name }++ } |
50 | map { $_->calculate_all_roles } @{ $self->roles }; |
51 | } |
52 | |
c3398f5b |
53 | sub superclasses { |
54 | my $self = shift; |
55 | |
56 | if (@_) { |
9d0686b2 |
57 | foreach my $super(@_){ |
58 | Mouse::Util::load_class($super); |
902174eb |
59 | my $meta = Mouse::Util::get_metaclass_by_name($super); |
7778ab1e |
60 | next if $self->verify_superclass($super, $meta); |
b6369395 |
61 | $self->_reconcile_with_superclass_meta($meta); |
9d0686b2 |
62 | } |
7778ab1e |
63 | return @{ $self->{superclasses} } = @_; |
c3398f5b |
64 | } |
65 | |
8e64d0fa |
66 | return @{ $self->{superclasses} }; |
67 | } |
902174eb |
68 | |
7778ab1e |
69 | sub verify_superclass { |
70 | my($self, $super, $super_meta) = @_; |
71 | |
72 | if(defined $super_meta) { |
73 | if(Mouse::Util::is_a_metarole($super_meta)){ |
74 | $self->throw_error("You cannot inherit from a Mouse Role ($super)"); |
75 | } |
76 | } |
77 | else { |
78 | # The metaclass of $super is not initialized. |
79 | # i.e. it might be Mouse::Object, a mixin package (e.g. Exporter), |
80 | # or a foreign class including Moose classes. |
81 | |
82 | # checks if $super is a foreign class (i.e. non-Mouse class) |
83 | # see also Mouse::Foreign::Meta::Role::Class |
84 | my $mm = $super->can('meta'); |
85 | if(!($mm && $mm == \&Mouse::Util::meta)) { |
86 | if($super->can('new') or $super->can('DESTROY')) { |
87 | $self->inherit_from_foreign_class($super); |
88 | } |
89 | } |
90 | return 1; # always ok |
91 | } |
92 | |
93 | return $self->isa(ref $super_meta); # checks metaclass compatibility |
94 | } |
95 | |
902174eb |
96 | sub inherit_from_foreign_class { |
97 | my($class, $super) = @_; |
98 | Carp::carp("You inherit from non-Mouse class ($super)," |
99 | . " but it is unlikely to work correctly." |
98278c01 |
100 | . " Please consider using MouseX::Foreign"); |
902174eb |
101 | return; |
102 | } |
103 | |
c0b18afd |
104 | my @MetaClassTypes = ( |
105 | 'attribute', # Mouse::Meta::Attribute |
106 | 'method', # Mouse::Meta::Method |
107 | 'constructor', # Mouse::Meta::Method::Constructor |
108 | 'destructor', # Mouse::Meta::Method::Destructor |
109 | ); |
8e64d0fa |
110 | |
b6369395 |
111 | sub _reconcile_with_superclass_meta { |
c0b18afd |
112 | my($self, $other) = @_; |
b6369395 |
113 | |
733f404b |
114 | # find incompatible traits |
c0b18afd |
115 | my %metaroles; |
b6369395 |
116 | foreach my $metaclass_type(@MetaClassTypes){ |
c0b18afd |
117 | my $accessor = $self->can($metaclass_type . '_metaclass') |
118 | || $self->can($metaclass_type . '_class'); |
b6369395 |
119 | |
c0b18afd |
120 | my $other_c = $other->$accessor(); |
121 | my $self_c = $self->$accessor(); |
b6369395 |
122 | |
c0b18afd |
123 | if(!$self_c->isa($other_c)){ |
124 | $metaroles{$metaclass_type} |
125 | = [ $self_c->meta->_collect_roles($other_c->meta) ]; |
d9659f80 |
126 | } |
127 | } |
128 | |
c0b18afd |
129 | $metaroles{class} = [$self->meta->_collect_roles($other->meta)]; |
130 | |
131 | #use Data::Dumper; print Data::Dumper->new([\%metaroles], ['*metaroles'])->Indent(1)->Dump; |
d9659f80 |
132 | |
133 | require Mouse::Util::MetaRole; |
c0b18afd |
134 | $_[0] = Mouse::Util::MetaRole::apply_metaroles( |
135 | for => $self, |
136 | class_metaroles => \%metaroles, |
d9659f80 |
137 | ); |
b6369395 |
138 | return; |
139 | } |
140 | |
c0b18afd |
141 | sub _collect_roles { |
142 | my ($self, $other) = @_; |
143 | |
144 | # find common ancestor |
145 | my @self_lin_isa = $self->linearized_isa; |
146 | my @other_lin_isa = $other->linearized_isa; |
147 | |
148 | my(@self_anon_supers, @other_anon_supers); |
149 | push @self_anon_supers, shift @self_lin_isa while $self_lin_isa[0]->meta->is_anon_class; |
150 | push @other_anon_supers, shift @other_lin_isa while $other_lin_isa[0]->meta->is_anon_class; |
151 | |
152 | my $common_ancestor = $self_lin_isa[0] eq $other_lin_isa[0] && $self_lin_isa[0]; |
153 | |
154 | if(!$common_ancestor){ |
155 | $self->throw_error(sprintf '%s cannot have %s as a super class because of their metaclass incompatibility', |
156 | $self->name, $other->name); |
157 | } |
158 | |
159 | my %seen; |
a4b15169 |
160 | return sort grep { !$seen{$_}++ } ## no critic |
c0b18afd |
161 | (map{ $_->name } map{ $_->meta->calculate_all_roles } @self_anon_supers), |
162 | (map{ $_->name } map{ $_->meta->calculate_all_roles } @other_anon_supers), |
163 | ; |
164 | } |
165 | |
166 | |
79345849 |
167 | sub find_method_by_name { |
8e64d0fa |
168 | my($self, $method_name) = @_; |
169 | defined($method_name) |
170 | or $self->throw_error('You must define a method name to find'); |
0126c27c |
171 | |
8e64d0fa |
172 | foreach my $class( $self->linearized_isa ){ |
173 | my $method = $self->initialize($class)->get_method($method_name); |
174 | return $method if defined $method; |
175 | } |
176 | return undef; |
177 | } |
178 | |
179 | sub get_all_methods { |
180 | my($self) = @_; |
612d3e1a |
181 | return map{ $self->find_method_by_name($_) } $self->get_all_method_names; |
c3398f5b |
182 | } |
183 | |
60cfc6ad |
184 | sub get_all_method_names { |
185 | my $self = shift; |
186 | my %uniq; |
187 | return grep { $uniq{$_}++ == 0 } |
3a63a2e7 |
188 | map { Mouse::Meta::Class->initialize($_)->get_method_list() } |
60cfc6ad |
189 | $self->linearized_isa; |
190 | } |
191 | |
abbcd124 |
192 | sub find_attribute_by_name { |
2b908b79 |
193 | my($self, $name) = @_; |
79345849 |
194 | defined($name) |
195 | or $self->throw_error('You must define an attribute name to find'); |
abbcd124 |
196 | foreach my $attr($self->get_all_attributes) { |
197 | return $attr if $attr->name eq $name; |
2b908b79 |
198 | } |
abbcd124 |
199 | return undef; |
2b908b79 |
200 | } |
201 | |
87ca293b |
202 | sub add_attribute { |
c3398f5b |
203 | my $self = shift; |
60f6eba9 |
204 | |
87ca293b |
205 | my($attr, $name); |
1b9e472d |
206 | |
1d76ae62 |
207 | if(Scalar::Util::blessed($_[0])){ |
87ca293b |
208 | $attr = $_[0]; |
1b9e472d |
209 | |
87ca293b |
210 | $attr->isa('Mouse::Meta::Attribute') |
211 | || $self->throw_error("Your attribute must be an instance of Mouse::Meta::Attribute (or a subclass)"); |
1b9e472d |
212 | |
87ca293b |
213 | $name = $attr->name; |
1b9e472d |
214 | } |
215 | else{ |
87ca293b |
216 | # _process_attribute |
217 | $name = shift; |
1b9e472d |
218 | |
87ca293b |
219 | my %args = (@_ == 1) ? %{$_[0]} : @_; |
1b9e472d |
220 | |
87ca293b |
221 | defined($name) |
222 | or $self->throw_error('You must provide a name for the attribute'); |
1b9e472d |
223 | |
87ca293b |
224 | if ($name =~ s/^\+//) { # inherited attributes |
2b908b79 |
225 | my $inherited_attr = $self->find_attribute_by_name($name) |
87ca293b |
226 | or $self->throw_error("Could not find an attribute by the name of '$name' to inherit from in ".$self->name); |
227 | |
8cf51b82 |
228 | $attr = $inherited_attr->clone_and_inherit_options(%args); |
87ca293b |
229 | } |
230 | else{ |
8cf51b82 |
231 | my($attribute_class, @traits) = $self->attribute_metaclass->interpolate_class(\%args); |
87ca293b |
232 | $args{traits} = \@traits if @traits; |
233 | |
2a464664 |
234 | $attr = $attribute_class->new($name, %args); |
87ca293b |
235 | } |
236 | } |
1b9e472d |
237 | |
1d76ae62 |
238 | Scalar::Util::weaken( $attr->{associated_class} = $self ); |
1b9e472d |
239 | |
df7e4729 |
240 | # install accessors first |
241 | $attr->install_accessors(); |
242 | |
243 | # then register the attribute to the metaclass |
abbcd124 |
244 | $attr->{insertion_order} = keys %{ $self->{attributes} }; |
245 | $self->{attributes}{$name} = $attr; |
246 | delete $self->{_mouse_cache}; # clears internal cache |
1b9e472d |
247 | |
3b48bcc8 |
248 | if(!$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){ |
249 | Carp::carp(qq{Attribute ($name) of class }.$self->name |
250 | .qq{ has no associated methods (did you mean to provide an "is" argument?)}); |
60f6eba9 |
251 | } |
abbcd124 |
252 | return $attr; |
253 | } |
74de0f8b |
254 | |
abbcd124 |
255 | sub _calculate_all_attributes { |
256 | my($self) = @_; |
257 | my %seen; |
258 | my @all_attrs; |
259 | foreach my $class($self->linearized_isa) { |
260 | my $meta = Mouse::Util::get_metaclass_by_name($class) or next; |
261 | my @attrs = grep { !$seen{$_->name}++ } values %{$meta->{attributes}}; |
262 | @attrs = sort { |
263 | $b->{insertion_order} <=> $a->{insertion_order} |
264 | } @attrs; |
265 | push @all_attrs, @attrs; |
a3a09e38 |
266 | } |
abbcd124 |
267 | return [reverse @all_attrs]; |
c3398f5b |
268 | } |
269 | |
cccb83de |
270 | sub linearized_isa; |
8536d351 |
271 | |
ba153b33 |
272 | sub new_object; |
13b99908 |
273 | sub clone_object; |
1b9e472d |
274 | |
cfef75f0 |
275 | sub immutable_options { |
276 | my ( $self, @args ) = @_; |
277 | |
278 | return ( |
7efbc77d |
279 | inline_constructor => 1, |
e578d610 |
280 | inline_destructor => 1, |
2a464664 |
281 | constructor_name => 'new', |
cfef75f0 |
282 | @args, |
6a1d1835 |
283 | ); |
cfef75f0 |
284 | } |
285 | |
cfef75f0 |
286 | sub make_immutable { |
287 | my $self = shift; |
288 | my %args = $self->immutable_options(@_); |
6a1d1835 |
289 | |
fc1d8369 |
290 | $self->{is_immutable}++; |
c7a6403f |
291 | |
6a1d1835 |
292 | if ($args{inline_constructor}) { |
380e1cd7 |
293 | $self->add_method($args{constructor_name} => |
637d4f17 |
294 | Mouse::Util::load_class($self->constructor_class) |
295 | ->_generate_constructor($self, \%args)); |
c7a6403f |
296 | } |
297 | |
8632b6fe |
298 | if ($args{inline_destructor}) { |
380e1cd7 |
299 | $self->add_method(DESTROY => |
637d4f17 |
300 | Mouse::Util::load_class($self->destructor_class) |
301 | ->_generate_destructor($self, \%args)); |
8632b6fe |
302 | } |
2276cb14 |
303 | |
89681b0b |
304 | # Moose's make_immutable returns true allowing calling code to skip |
305 | # setting an explicit true value at the end of a source file. |
2276cb14 |
306 | return 1; |
fc1d8369 |
307 | } |
ad958001 |
308 | |
32490a72 |
309 | sub make_mutable { |
310 | my($self) = @_; |
311 | $self->{is_immutable} = 0; |
312 | return; |
313 | } |
ad958001 |
314 | |
80efe911 |
315 | sub is_immutable; |
316 | sub is_mutable { !$_[0]->is_immutable } |
84ef660f |
317 | |
8d5287a7 |
318 | sub _install_modifier { |
8d59c723 |
319 | my( $self, $type, $name, $code ) = @_; |
320 | my $into = $self->name; |
3fbade18 |
321 | |
322 | my $original = $into->can($name) |
083e49a5 |
323 | or $self->throw_error("The method '$name' was not found in the inheritance hierarchy for $into"); |
3fbade18 |
324 | |
325 | my $modifier_table = $self->{modifiers}{$name}; |
326 | |
327 | if(!$modifier_table){ |
d686eec5 |
328 | my(@before, @after, @around); |
329 | my $cache = $original; |
1b490891 |
330 | my $modified = sub { |
d686eec5 |
331 | if(@before) { |
332 | for my $c (@before) { $c->(@_) } |
333 | } |
334 | unless(@after) { |
1b490891 |
335 | return $cache->(@_); |
336 | } |
337 | |
3fbade18 |
338 | if(wantarray){ # list context |
339 | my @rval = $cache->(@_); |
340 | |
341 | for my $c(@after){ $c->(@_) } |
342 | return @rval; |
343 | } |
344 | elsif(defined wantarray){ # scalar context |
345 | my $rval = $cache->(@_); |
346 | |
347 | for my $c(@after){ $c->(@_) } |
348 | return $rval; |
349 | } |
350 | else{ # void context |
351 | $cache->(@_); |
352 | |
353 | for my $c(@after){ $c->(@_) } |
354 | return; |
355 | } |
356 | }; |
357 | |
358 | $self->{modifiers}{$name} = $modifier_table = { |
359 | original => $original, |
360 | |
361 | before => \@before, |
362 | after => \@after, |
d686eec5 |
363 | around => \@around, |
3fbade18 |
364 | |
365 | cache => \$cache, # cache for around modifiers |
366 | }; |
367 | |
368 | $self->add_method($name => $modified); |
369 | } |
370 | |
371 | if($type eq 'before'){ |
372 | unshift @{$modifier_table->{before}}, $code; |
373 | } |
374 | elsif($type eq 'after'){ |
375 | push @{$modifier_table->{after}}, $code; |
376 | } |
377 | else{ # around |
378 | push @{$modifier_table->{around}}, $code; |
379 | |
380 | my $next = ${ $modifier_table->{cache} }; |
381 | ${ $modifier_table->{cache} } = sub{ $code->($next, @_) }; |
382 | } |
383 | |
384 | return; |
385 | } |
386 | |
50dc6ee5 |
387 | sub add_before_method_modifier { |
4859d490 |
388 | my ( $self, $name, $code ) = @_; |
8d59c723 |
389 | $self->_install_modifier( 'before', $name, $code ); |
50dc6ee5 |
390 | } |
391 | |
392 | sub add_around_method_modifier { |
4859d490 |
393 | my ( $self, $name, $code ) = @_; |
8d59c723 |
394 | $self->_install_modifier( 'around', $name, $code ); |
50dc6ee5 |
395 | } |
396 | |
397 | sub add_after_method_modifier { |
4859d490 |
398 | my ( $self, $name, $code ) = @_; |
8d59c723 |
399 | $self->_install_modifier( 'after', $name, $code ); |
50dc6ee5 |
400 | } |
401 | |
67199842 |
402 | sub add_override_method_modifier { |
403 | my ($self, $name, $code) = @_; |
404 | |
768804c0 |
405 | if($self->has_method($name)){ |
406 | $self->throw_error("Cannot add an override method if a local method is already present"); |
85bd3f44 |
407 | } |
408 | |
6cfa1e5e |
409 | my $package = $self->name; |
67199842 |
410 | |
85bd3f44 |
411 | my $super_body = $package->can($name) |
6cfa1e5e |
412 | or $self->throw_error("You cannot override '$name' because it has no super method"); |
67199842 |
413 | |
85bd3f44 |
414 | $self->add_method($name => sub { |
415 | local $Mouse::SUPER_PACKAGE = $package; |
416 | local $Mouse::SUPER_BODY = $super_body; |
417 | local @Mouse::SUPER_ARGS = @_; |
418 | |
419 | $code->(@_); |
420 | }); |
421 | return; |
67199842 |
422 | } |
423 | |
768804c0 |
424 | sub add_augment_method_modifier { |
425 | my ($self, $name, $code) = @_; |
426 | if($self->has_method($name)){ |
427 | $self->throw_error("Cannot add an augment method if a local method is already present"); |
428 | } |
429 | |
430 | my $super = $self->find_method_by_name($name) |
431 | or $self->throw_error("You cannot augment '$name' because it has no super method"); |
432 | |
433 | my $super_package = $super->package_name; |
434 | my $super_body = $super->body; |
435 | |
436 | $self->add_method($name => sub{ |
437 | local $Mouse::INNER_BODY{$super_package} = $code; |
438 | local $Mouse::INNER_ARGS{$super_package} = [@_]; |
439 | $super_body->(@_); |
440 | }); |
441 | return; |
442 | } |
443 | |
47f36c05 |
444 | sub does_role { |
445 | my ($self, $role_name) = @_; |
ad958001 |
446 | |
47f36c05 |
447 | (defined $role_name) |
fce211ae |
448 | || $self->throw_error("You must supply a role name to look for"); |
ad958001 |
449 | |
f3e11122 |
450 | $role_name = $role_name->name if ref $role_name; |
451 | |
f7fec86c |
452 | for my $class ($self->linearized_isa) { |
95ecd6f1 |
453 | my $meta = Mouse::Util::get_metaclass_by_name($class) |
454 | or next; |
3a63a2e7 |
455 | |
456 | for my $role (@{ $meta->roles }) { |
ff687069 |
457 | |
3a63a2e7 |
458 | return 1 if $role->does_role($role_name); |
f7fec86c |
459 | } |
47f36c05 |
460 | } |
ad958001 |
461 | |
47f36c05 |
462 | return 0; |
463 | } |
464 | |
c3398f5b |
465 | 1; |
c3398f5b |
466 | __END__ |
467 | |
468 | =head1 NAME |
469 | |
1820fffe |
470 | Mouse::Meta::Class - The Mouse class metaclass |
c3398f5b |
471 | |
a25ca8d6 |
472 | =head1 VERSION |
473 | |
a7e3b78e |
474 | This document describes Mouse version 0.76 |
a25ca8d6 |
475 | |
503ed648 |
476 | =head1 DESCRIPTION |
477 | |
478 | This class is a meta object protocol for Mouse classes, |
479 | which is a subset of Moose::Meta:::Class. |
480 | |
c3398f5b |
481 | =head1 METHODS |
482 | |
612d3e1a |
483 | =head2 C<< initialize(ClassName) -> Mouse::Meta::Class >> |
c3398f5b |
484 | |
31c5194b |
485 | Finds or creates a C<Mouse::Meta::Class> instance for the given ClassName. Only |
306290e8 |
486 | one instance should exist for a given class. |
c3398f5b |
487 | |
612d3e1a |
488 | =head2 C<< name -> ClassName >> |
c3398f5b |
489 | |
490 | Returns the name of the owner class. |
491 | |
612d3e1a |
492 | =head2 C<< superclasses -> ClassNames >> C<< superclass(ClassNames) >> |
c3398f5b |
493 | |
494 | Gets (or sets) the list of superclasses of the owner class. |
495 | |
31c5194b |
496 | =head2 C<< add_method(name => CodeRef) >> |
c3398f5b |
497 | |
31c5194b |
498 | Adds a method to the owner class. |
c3398f5b |
499 | |
31c5194b |
500 | =head2 C<< has_method(name) -> Bool >> |
72b88a88 |
501 | |
31c5194b |
502 | Returns whether we have a method with the given name. |
72b88a88 |
503 | |
31c5194b |
504 | =head2 C<< get_method(name) -> Mouse::Meta::Method | undef >> |
c68b4110 |
505 | |
31c5194b |
506 | Returns a L<Mouse::Meta::Method> with the given name. |
507 | |
508 | Note that you can also use C<< $metaclass->name->can($name) >> for a method body. |
509 | |
510 | =head2 C<< get_method_list -> Names >> |
511 | |
512 | Returns a list of method names which are defined in the local class. |
513 | If you want a list of all applicable methods for a class, use the |
514 | C<get_all_methods> method. |
515 | |
516 | =head2 C<< get_all_methods -> (Mouse::Meta::Method) >> |
517 | |
518 | Return the list of all L<Mouse::Meta::Method> instances associated with |
519 | the class and its superclasses. |
520 | |
521 | =head2 C<< add_attribute(name => spec | Mouse::Meta::Attribute) >> |
522 | |
523 | Begins keeping track of the existing L<Mouse::Meta::Attribute> for the owner |
524 | class. |
c68b4110 |
525 | |
612d3e1a |
526 | =head2 C<< has_attribute(Name) -> Bool >> |
66eea168 |
527 | |
528 | Returns whether we have a L<Mouse::Meta::Attribute> with the given name. |
529 | |
31c5194b |
530 | =head2 C<< get_attribute Name -> Mouse::Meta::Attribute | undef >> |
c3398f5b |
531 | |
306290e8 |
532 | Returns the L<Mouse::Meta::Attribute> with the given name. |
c3398f5b |
533 | |
31c5194b |
534 | =head2 C<< get_attribute_list -> Names >> |
535 | |
536 | Returns a list of attribute names which are defined in the local |
537 | class. If you want a list of all applicable attributes for a class, |
538 | use the C<get_all_attributes> method. |
539 | |
540 | =head2 C<< get_all_attributes -> (Mouse::Meta::Attribute) >> |
541 | |
542 | Returns the list of all L<Mouse::Meta::Attribute> instances associated with |
543 | this class and its superclasses. |
544 | |
612d3e1a |
545 | =head2 C<< linearized_isa -> [ClassNames] >> |
c3398f5b |
546 | |
547 | Returns the list of classes in method dispatch order, with duplicates removed. |
548 | |
612d3e1a |
549 | =head2 C<< new_object(Parameters) -> Instance >> |
2cea7a5f |
550 | |
612d3e1a |
551 | Creates a new instance. |
2cea7a5f |
552 | |
612d3e1a |
553 | =head2 C<< clone_object(Instance, Parameters) -> Instance >> |
f7b11a21 |
554 | |
31c5194b |
555 | Clones the given instance which must be an instance governed by this |
f7b11a21 |
556 | metaclass. |
557 | |
31c5194b |
558 | =head2 C<< throw_error(Message, Parameters) >> |
559 | |
560 | Throws an error with the given message. |
561 | |
1820fffe |
562 | =head1 SEE ALSO |
f7b11a21 |
563 | |
6b82419e |
564 | L<Mouse::Meta::Module> |
565 | |
1820fffe |
566 | L<Moose::Meta::Class> |
f7b11a21 |
567 | |
31c5194b |
568 | L<Class::MOP::Class> |
569 | |
c3398f5b |
570 | =cut |
571 | |