X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP.pm;h=b7d634ccbd67c74a9c34cbf68ed522faeabe6bfe;hb=91e0eb4ac2962e557cddb12683d6cf3ad339409f;hp=7ae48cc6662ac7c89527785a7240b79b388c1c3c;hpb=b9d9fc0b01c940ad89c092eaf01e67c23b6036d5;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 7ae48cc..b7d634c 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -13,7 +13,7 @@ use Class::MOP::Method; use Class::MOP::Class::Immutable; -our $VERSION = '0.33'; +our $VERSION = '0.34'; our $AUTHORITY = 'cpan:STEVAN'; { @@ -83,16 +83,22 @@ Class::MOP::Package->meta->add_attribute( Class::MOP::Package->meta->add_attribute( Class::MOP::Attribute->new('%:namespace' => ( reader => { - 'namespace' => sub { (shift)->{'%:namespace'} } - }, - default => sub { - my ($class) = @_; - no strict 'refs'; - return \%{$class->name . '::'}; + # NOTE: + # because of issues with the Perl API + # to the typeglob in some versions, we + # need to just always grab a new + # reference to the hash here. Ideally + # we could just store a ref and it would + # Just Work, but oh well :\ + 'namespace' => sub { + no strict 'refs'; + \%{$_[0]->name . '::'} + } }, # NOTE: # protect this from silliness init_arg => '!............( DO NOT DO THIS )............!', + default => sub { \undef } )) ); @@ -129,6 +135,7 @@ Class::MOP::Module->meta->add_attribute( # NOTE: # protect this from silliness init_arg => '!............( DO NOT DO THIS )............!', + default => sub { \undef } )) ); @@ -149,6 +156,7 @@ Class::MOP::Module->meta->add_attribute( # NOTE: # protect this from silliness init_arg => '!............( DO NOT DO THIS )............!', + default => sub { \undef } )) ); @@ -169,6 +177,24 @@ Class::MOP::Class->meta->add_attribute( ); Class::MOP::Class->meta->add_attribute( + Class::MOP::Attribute->new('%:methods' => ( + reader => { + 'get_method_map' => sub { + my $self = shift; + my $map = $self->{'%:methods'}; + foreach my $symbol ($self->list_all_package_symbols('CODE')) { + my $code = $self->get_package_symbol('&' . $symbol); + next if exists $map->{$symbol} && $map->{$symbol}->body == $code; + $map->{$symbol} = $self->method_metaclass->wrap($code); + } + return $map; + } + }, + default => sub { {} } + )) +); + +Class::MOP::Class->meta->add_attribute( Class::MOP::Attribute->new('$:attribute_metaclass' => ( reader => 'attribute_metaclass', init_arg => ':attribute_metaclass',