X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP.pm;h=7707c61ceac42d37e2febe8fe275eecd8f16aca6;hb=5f90deee7aaaa91b691b9bee49ed681daa311b69;hp=8ddb78d6556bfa41e671bfa89c2e86fc928407d9;hpb=e41d1dd685584e6461d9198a9478404025022e29;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 8ddb78d..7707c61 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -9,7 +9,7 @@ use 5.008; use MRO::Compat; use Carp 'confess'; -use Scalar::Util 'weaken', 'reftype', 'blessed'; +use Scalar::Util 'weaken', 'isweak', 'reftype', 'blessed'; use Data::OptList; use Try::Tiny; @@ -29,7 +29,7 @@ BEGIN { *check_package_cache_flag = \&mro::get_pkg_gen; } -our $VERSION = '1.06'; +our $VERSION = '1.11'; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -51,6 +51,7 @@ XSLoader::load( __PACKAGE__, $XS_VERSION ); sub get_metaclass_by_name { $METAS{$_[0]} } sub store_metaclass_by_name { $METAS{$_[0]} = $_[1] } sub weaken_metaclass { weaken($METAS{$_[0]}) } + sub metaclass_is_weak { isweak($METAS{$_[0]}) } sub does_metaclass_exist { exists $METAS{$_[0]} && defined $METAS{$_[0]} } sub remove_metaclass_by_name { delete $METAS{$_[0]}; return } @@ -186,7 +187,7 @@ Class::MOP::Mixin::HasMethods->meta->add_attribute( # NOTE: # we just alias the original method # rather than re-produce it here - '_full_method_map' => \&Class::MOP::Mixin::HasMethods::_full_method_map + '_method_map' => \&Class::MOP::Mixin::HasMethods::_method_map }, default => sub { {} } )) @@ -664,6 +665,18 @@ Class::MOP::Instance->meta->add_attribute( ), ); +## -------------------------------------------------------- +## Class::MOP::Object + +# need to replace the meta method there with a real meta method object +Class::MOP::Object->meta->_add_meta_method('meta'); + +## -------------------------------------------------------- +## Class::MOP::Mixin + +# need to replace the meta method there with a real meta method object +Class::MOP::Mixin->meta->_add_meta_method('meta'); + require Class::MOP::Deprecated unless our $no_deprecated; # we need the meta instance of the meta instance to be created now, in order @@ -700,6 +713,8 @@ $_->meta->make_immutable( Class::MOP::Method::Accessor Class::MOP::Method::Constructor Class::MOP::Method::Wrapped + + Class::MOP::Method::Meta /; $_->meta->make_immutable( @@ -1054,6 +1069,11 @@ store a weakened reference in the metaclass cache. This function will weaken the reference to the metaclass stored in C<$name>. +=item B + +Returns true if the metaclass for C<$name> has been weakened +(via C). + =item B This will return true of there exists a metaclass stored in the @@ -1130,7 +1150,7 @@ L =item L -=item L +=item L =back