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