X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod%2FGenerated.pm;h=ed3b7b1ccc2ec74d8a6931b2a6f1bfa6c181c086;hb=f65af096d1abfd83aea3cde248e6a5886aee648c;hp=0b3456a7c384ac0d1d7440800c58428f2c5b2157;hpb=69e3ab0a5a391925610bbb917d81da8d53fd1b91;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method/Generated.pm b/lib/Class/MOP/Method/Generated.pm index 0b3456a..ed3b7b1 100644 --- a/lib/Class/MOP/Method/Generated.pm +++ b/lib/Class/MOP/Method/Generated.pm @@ -6,7 +6,8 @@ use warnings; use Carp 'confess'; -our $VERSION = '0.01'; +our $VERSION = '0.64_04'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use base 'Class::MOP::Method'; @@ -15,21 +16,29 @@ sub new { my $class = shift; my %options = @_; - my $self = bless { - # from our superclass - '&!body' => undef, - # specific to this subclass - '$!is_inline' => ($options{is_inline} || 0), - } => $class; + ($options{package_name} && $options{name}) + || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT"; + + my $self = $class->_new(\%options); $self->initialize_body; return $self; } +sub _new { + my $class = shift; + my $options = @_ == 1 ? $_[0] : {@_}; + + $options->{is_inline} ||= 0; + $options->{body} ||= undef; + + bless $options, $class; +} + ## accessors -sub is_inline { (shift)->{'$!is_inline'} } +sub is_inline { (shift)->{'is_inline'} } sub initialize_body { confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class";