Commit | Line | Data |
---|---|---|
8ee73eeb | 1 | package Moose::Meta::Method; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
d2782813 | 6 | use Class::MOP::MiniTrait; |
7 | ||
8ee73eeb | 8 | use base 'Class::MOP::Method'; |
9 | ||
d2782813 | 10 | Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); |
11 | ||
3e504337 | 12 | sub _error_thrower { |
13 | my $self = shift; | |
18748ad6 | 14 | ( ref $self && $self->associated_metaclass ) || "Moose::Meta::Class"; |
3e504337 | 15 | } |
16 | ||
cee532a1 | 17 | sub throw_error { |
18 | my $self = shift; | |
3e504337 | 19 | my $inv = $self->_error_thrower; |
cee532a1 | 20 | unshift @_, "message" if @_ % 2 == 1; |
21 | unshift @_, method => $self if ref $self; | |
22 | unshift @_, $inv; | |
ffa3d7bf | 23 | my $handler = $inv->can("throw_error"); |
24 | goto $handler; # to avoid incrementing depth by 1 | |
cee532a1 | 25 | } |
26 | ||
27 | sub _inline_throw_error { | |
28 | my ( $self, $msg, $args ) = @_; | |
29 | "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard | |
30 | } | |
31 | ||
8ee73eeb | 32 | 1; |
33 | ||
ad46f524 | 34 | # ABSTRACT: A Moose Method metaclass |
35 | ||
8ee73eeb | 36 | __END__ |
37 | ||
38 | =pod | |
39 | ||
39b3bc94 | 40 | =head1 DESCRIPTION |
41 | ||
bef3ee55 | 42 | This class is a subclass of L<Class::MOP::Method> that provides |
e3177578 | 43 | additional Moose-specific functionality, all of which is private. |
39b3bc94 | 44 | |
bef3ee55 | 45 | To understand this class, you should read the the L<Class::MOP::Method> |
e3177578 | 46 | documentation. |
cee532a1 | 47 | |
d4b1449e | 48 | =head1 INHERITANCE |
49 | ||
50 | C<Moose::Meta::Method> is a subclass of L<Class::MOP::Method>. | |
51 | ||
39b3bc94 | 52 | =head1 BUGS |
53 | ||
d4048ef3 | 54 | See L<Moose/BUGS> for details on reporting bugs. |
39b3bc94 | 55 | |
cee532a1 | 56 | =cut |