X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FModule.pm;h=f9afa5c7b31ee1816af1fd1e66b5f39a20485cff;hb=86eb0b5e6f0c2d89a6c86516e7bccbf9c7daba1f;hp=b193932fbc06d8496abc0f6532d3db14df25df4b;hpb=98a8fd12ede46b22edc10d229680d9d2e8deeade;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index b193932..f9afa5c 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -15,7 +15,7 @@ if(Mouse::Util::MOUSE_XS){ } sub _metaclass_cache { # DEPRECATED - my($class, $name) = @_; + my($self, $name) = @_; Carp::cluck('_metaclass_cache() has been deprecated. Use Mouse::Util::get_metaclass_by_name() instead'); return $METAS{$name}; } @@ -231,7 +231,7 @@ sub create { Scalar::Util::weaken $METAS{$package_name} if $mortal; - $meta->add_method(meta => sub{ + $meta->add_method(meta => sub { $self->initialize(ref($_[0]) || $_[0]); }); @@ -283,6 +283,13 @@ sub DESTROY{ return if !$serial_id; # mortal anonymous class + # XXX: cleaning stash with threads causes panic/SEGV. + if(exists $INC{'threads.pm'}) { + # (caller)[2] indicates the caller's line number, + # which is zero when the current thread is joining. + return if( (caller)[2] == 0); + } + # @ISA is a magical variable, so we clear it manually. @{$self->{superclasses}} = () if exists $self->{superclasses}; @@ -293,7 +300,6 @@ sub DESTROY{ delete $METAS{$name}; $name =~ s/ $serial_id \z//xms; - no strict 'refs'; delete ${$name}{ $serial_id . '::' }; @@ -301,7 +307,7 @@ sub DESTROY{ } sub throw_error{ - my($class, $message, %args) = @_; + my($self, $message, %args) = @_; local $Carp::CarpLevel = $Carp::CarpLevel + 1 + ($args{depth} || 0); local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though @@ -323,7 +329,12 @@ Mouse::Meta::Module - The base class for Mouse::Meta::Class and Mouse::Meta::Rol =head1 VERSION -This document describes Mouse version 0.50_05 +This document describes Mouse version 0.70 + +=head1 DESCRIPTION + +This class is a base class of Mouse classes and roles, +which is a subset of Class::MOP::Class. =head1 SEE ALSO