Version 1.04
[gitmo/Moose.git] / lib / Moose / Meta / Method.pm
CommitLineData
8ee73eeb 1package Moose::Meta::Method;
2
3use strict;
4use warnings;
5
40290d18 6our $VERSION = '1.04';
e606ae5f 7$VERSION = eval $VERSION;
d44714be 8our $AUTHORITY = 'cpan:STEVAN';
8ee73eeb 9
10use base 'Class::MOP::Method';
11
3e504337 12sub _error_thrower {
13 my $self = shift;
18748ad6 14 ( ref $self && $self->associated_metaclass ) || "Moose::Meta::Class";
3e504337 15}
16
cee532a1 17sub 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
27sub _inline_throw_error {
28 my ( $self, $msg, $args ) = @_;
29 "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard
30}
31
8ee73eeb 321;
33
34__END__
35
36=pod
37
39b3bc94 38=head1 NAME
39
ecb59493 40Moose::Meta::Method - A Moose Method metaclass
39b3bc94 41
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
58=head1 AUTHOR
59
60Stevan Little E<lt>stevan@iinteractive.comE<gt>
61
39b3bc94 62=head1 COPYRIGHT AND LICENSE
63
7e0492d3 64Copyright 2006-2010 by Infinity Interactive, Inc.
39b3bc94 65
66L<http://www.iinteractive.com>
67
68This library is free software; you can redistribute it and/or modify
69it under the same terms as Perl itself.
70
cee532a1 71=cut