X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod.pm;h=b14380d5c87d2b0255f566d9ac83ac591db47c8f;hb=bbd059cd6d8708db41702f52b2ce5b978af430e6;hp=70aea2f5111c1f2be7ebbcb44229e3812ba52bae;hpb=07b0f1a5599bf1a0ed99933200ca27290e9a468a;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method.pm b/lib/Moose/Meta/Method.pm index 70aea2f..b14380d 100644 --- a/lib/Moose/Meta/Method.pm +++ b/lib/Moose/Meta/Method.pm @@ -3,11 +3,32 @@ package Moose::Meta::Method; use strict; use warnings; -our $VERSION = '0.51'; +our $VERSION = '1.00'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Method'; +sub _error_thrower { + my $self = shift; + ( ref $self && $self->associated_metaclass ) || "Moose::Meta::Class"; +} + +sub throw_error { + my $self = shift; + my $inv = $self->_error_thrower; + unshift @_, "message" if @_ % 2 == 1; + unshift @_, method => $self if ref $self; + unshift @_, $inv; + my $handler = $inv->can("throw_error"); + goto $handler; # to avoid incrementing depth by 1 +} + +sub _inline_throw_error { + my ( $self, $msg, $args ) = @_; + "\$meta->throw_error($msg" . ($args ? ", $args" : "") . ")"; # FIXME makes deparsing *REALLY* hard +} + 1; __END__ @@ -20,15 +41,19 @@ Moose::Meta::Method - A Moose Method metaclass =head1 DESCRIPTION -For now, this is nothing but a subclass of Class::MOP::Method, -but with the expanding role of the method sub-protocol, it might -be more useful later on. +This class is a subclass of L that provides +additional Moose-specific functionality, all of which is private. + +To understand this class, you should read the the L +documentation. + +=head1 INHERITANCE + +C is a subclass of L. =head1 BUGS -All complex software has bugs lurking in it, and this module is no -exception. If you find a bug please either email me, or add the bug -to cpan-RT. +See L for details on reporting bugs. =head1 AUTHOR @@ -36,7 +61,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2010 by Infinity Interactive, Inc. L