X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod.pm;h=74cbe8d03f55a2e4359b4592a9586f8be7c8780c;hb=28070619769a4cf26b800d161f9d05cc9a6493ab;hp=603646b4d79144b4b0f26289e1342a4456bac532;hpb=3eb89f709f04907580b508f821d6be2316fcb65f;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method.pm b/lib/Moose/Meta/Method.pm index 603646b..74cbe8d 100644 --- a/lib/Moose/Meta/Method.pm +++ b/lib/Moose/Meta/Method.pm @@ -3,14 +3,15 @@ package Moose::Meta::Method; use strict; use warnings; -our $VERSION = '1.01'; -$VERSION = eval $VERSION; -our $AUTHORITY = 'cpan:STEVAN'; +use Class::MOP::MiniTrait; use base 'Class::MOP::Method'; +Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); + sub _error_thrower { my $self = shift; + require Moose::Meta::Class; ( ref $self && $self->associated_metaclass ) || "Moose::Meta::Class"; } @@ -26,19 +27,32 @@ sub throw_error { sub _inline_throw_error { my ( $self, $msg, $args ) = @_; - "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard + + my $inv = $self->_error_thrower; + # XXX ugh + $inv = 'Moose::Meta::Class' unless $inv->can('_inline_throw_error'); + + # XXX ugh ugh UGH + my $class = $self->associated_metaclass; + if ($class) { + my $class_name = B::perlstring($class->name); + my $meth_name = B::perlstring($self->name); + $args = 'method => Class::MOP::class_of(' . $class_name . ')' + . '->find_method_by_name(' . $meth_name . '), ' + . (defined $args ? $args : ''); + } + + return $inv->_inline_throw_error($msg, $args) } 1; +# ABSTRACT: A Moose Method metaclass + __END__ =pod -=head1 NAME - -Moose::Meta::Method - A Moose Method metaclass - =head1 DESCRIPTION This class is a subclass of L that provides @@ -55,17 +69,4 @@ C is a subclass of L. See L for details on reporting bugs. -=head1 AUTHOR - -Stevan Little Estevan@iinteractive.comE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2006-2010 by Infinity Interactive, Inc. - -L - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - =cut