bump version to 1.18
[gitmo/Moose.git] / lib / Moose / Meta / Method.pm
1 package Moose::Meta::Method;
2
3 use strict;
4 use warnings;
5
6 our $VERSION   = '1.18';
7 $VERSION = eval $VERSION;
8 our $AUTHORITY = 'cpan:STEVAN';
9
10 use Class::MOP::MiniTrait;
11
12 use base 'Class::MOP::Method';
13
14 Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
15
16 sub _error_thrower {
17     my $self = shift;
18     ( ref $self && $self->associated_metaclass ) || "Moose::Meta::Class";
19 }
20
21 sub throw_error {
22     my $self = shift;
23     my $inv = $self->_error_thrower;
24     unshift @_, "message" if @_ % 2 == 1;
25     unshift @_, method => $self if ref $self;
26     unshift @_, $inv;
27     my $handler = $inv->can("throw_error");
28     goto $handler; # to avoid incrementing depth by 1
29 }
30
31 sub _inline_throw_error {
32     my ( $self, $msg, $args ) = @_;
33     "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard
34 }
35
36 1;
37
38 __END__
39
40 =pod
41
42 =head1 NAME
43
44 Moose::Meta::Method - A Moose Method metaclass
45
46 =head1 DESCRIPTION
47
48 This class is a subclass of L<Class::MOP::Method> that provides
49 additional Moose-specific functionality, all of which is private.
50
51 To understand this class, you should read the the L<Class::MOP::Method>
52 documentation.
53
54 =head1 INHERITANCE
55
56 C<Moose::Meta::Method> is a subclass of L<Class::MOP::Method>.
57
58 =head1 BUGS
59
60 See L<Moose/BUGS> for details on reporting bugs.
61
62 =head1 AUTHOR
63
64 Stevan Little E<lt>stevan@iinteractive.comE<gt>
65
66 =head1 COPYRIGHT AND LICENSE
67
68 Copyright 2006-2010 by Infinity Interactive, Inc.
69
70 L<http://www.iinteractive.com>
71
72 This library is free software; you can redistribute it and/or modify
73 it under the same terms as Perl itself.
74
75 =cut