Enum needs to check that the value is not a ref
[gitmo/Moose.git] / lib / Moose / Meta / Method.pm
CommitLineData
8ee73eeb 1package Moose::Meta::Method;
2
3use strict;
4use warnings;
5
d2782813 6use Class::MOP::MiniTrait;
7
8ee73eeb 8use base 'Class::MOP::Method';
9
d2782813 10Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
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
ad46f524 34# ABSTRACT: A Moose Method metaclass
35
8ee73eeb 36__END__
37
38=pod
39
39b3bc94 40=head1 DESCRIPTION
41
bef3ee55 42This class is a subclass of L<Class::MOP::Method> that provides
e3177578 43additional Moose-specific functionality, all of which is private.
39b3bc94 44
bef3ee55 45To understand this class, you should read the the L<Class::MOP::Method>
e3177578 46documentation.
cee532a1 47
d4b1449e 48=head1 INHERITANCE
49
50C<Moose::Meta::Method> is a subclass of L<Class::MOP::Method>.
51
39b3bc94 52=head1 BUGS
53
d4048ef3 54See L<Moose/BUGS> for details on reporting bugs.
39b3bc94 55
cee532a1 56=cut