X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FMethod.pm;h=68b1a8f4f1e049175876fb3ba1cdacbaefbb983d;hp=a1f4a4198454e657b53c252aec697a0ec5996824;hb=cf59b7151d2b476a74b5abd84af37770ad4cf387;hpb=06a970ab9fb60a4cac5e3f1774cf9a2914c94cc1 diff --git a/lib/Mouse/Meta/Method.pm b/lib/Mouse/Meta/Method.pm index a1f4a41..68b1a8f 100755 --- a/lib/Mouse/Meta/Method.pm +++ b/lib/Mouse/Meta/Method.pm @@ -2,27 +2,37 @@ package Mouse::Meta::Method; use Mouse::Util qw(:meta); # enables strict and warnings use overload - '&{}' => 'body', + '&{}' => sub{ $_[0]->body }, fallback => 1, ; -sub new{ +sub wrap{ + my $class = shift; + + return $class->_new(@_); +} + +sub _new{ my($class, %args) = @_; + my $self = bless \%args, $class; - return bless \%args, $class; + if($class ne __PACKAGE__){ + $self->meta->_initialize_object($self, \%args); + } + return $self; } -sub body { $_[0]->{body} } -sub name { $_[0]->{name} } -sub package_name{ $_[0]->{package} } +sub body { $_[0]->{body} } +sub name { $_[0]->{name} } +sub package_name { $_[0]->{package} } +sub associated_metaclass { $_[0]->{associated_metaclass} } sub fully_qualified_name { - my $self = shift; + my($self) = @_; return $self->package_name . '::' . $self->name; } 1; - __END__ =head1 NAME @@ -31,7 +41,7 @@ Mouse::Meta::Method - A Mouse Method metaclass =head1 VERSION -This document describes Mouse version 0.38 +This document describes Mouse version 0.40_09 =head1 SEE ALSO