X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP.pm;h=fc7595203b840e92eddc9fae52c4c5517c43ed12;hb=d004c8d565f9b314da7652e9368aeb4587ffaa3d;hp=6a78cfd82e899899672298f16d168a6ab7946d08;hpb=0e734d64ed657f0acb36d0ec28b6d03019405d14;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index 6a78cfd..fc75952 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.03'; +our $VERSION = '1.12'; our $XS_VERSION = $VERSION; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -37,7 +37,6 @@ our $AUTHORITY = 'cpan:STEVAN'; require XSLoader; XSLoader::load( __PACKAGE__, $XS_VERSION ); - { # Metaclasses are singletons, so we cache them here. # there is no need to worry about destruction though @@ -52,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 } @@ -187,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 { {} } )) @@ -549,13 +549,6 @@ Class::MOP::Method->meta->add_attribute( )) ); -Class::MOP::Method->meta->add_method('clone' => sub { - my $self = shift; - my $clone = $self->meta->clone_object($self, @_); - $clone->_set_original_method($self); - return $clone; -}); - ## -------------------------------------------------------- ## Class::MOP::Method::Wrapped @@ -672,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 @@ -708,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( @@ -1062,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 @@ -1138,7 +1150,7 @@ L =item L -=item L +=item L =back