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=be03cfff22ded26be6df1dae179c394d7cf169d8;hp=21cff59d13fdc075efe641dd84686c97678b512d;hb=e128626c409797822ffd8a4079f833eb3dc0fd37;hpb=612d3e1a65aebf8042df5972079695883a4eec6e diff --git a/lib/Mouse/Meta/Method.pm b/lib/Mouse/Meta/Method.pm index 21cff59..be03cff 100755 --- a/lib/Mouse/Meta/Method.pm +++ b/lib/Mouse/Meta/Method.pm @@ -1,39 +1,52 @@ package Mouse::Meta::Method; -use strict; -use warnings; - -use Mouse::Util qw(:meta); +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 Mouse::Meta::Method - A Mouse Method metaclass +=head1 VERSION + +This document describes Mouse version 0.50_01 + =head1 SEE ALSO L +L + =cut