X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FModule.pm;h=be07d803840ff18aaca757632744a7a58c0f77a6;hb=902174eb6dc2afbe8a2b8fb0a27446b3276787d8;hp=c11335f43c0e60355b3d237606e01f65669a435d;hpb=fdef448eeca7cc251e2fbb53a141919add2bd306;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index c11335f..be07d80 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -38,6 +38,9 @@ sub reinitialize { ($package_name && !ref($package_name)) || $class->throw_error("You must pass a package name and it cannot be blessed"); + if(exists $METAS{$package_name}) { + unshift @args, %{ $METAS{$package_name} }; + } delete $METAS{$package_name}; return $class->initialize($package_name, @args); } @@ -150,7 +153,8 @@ sub _collect_methods { # Mouse specific my $subname = ( caller(1) )[3]; $meta->throw_error( sprintf( - 'Methods passed to %s must be provided as a list, ArrayRef or regular expression, not %s', + 'Methods passed to %s must be provided as a list,' + . ' ArrayRef or regular expression, not %s', $subname, $type, ) @@ -279,11 +283,18 @@ sub DESTROY{ return if $Mouse::Util::in_global_destruction; my $serial_id = $self->{anon_serial_id}; - return if !$serial_id; - # mortal anonymous class - # @ISA is a magical variable, so we clear it manually. + # XXX: cleaning stash with threads causes panic/SEGV on legacy perls. + if(exists $INC{'threads.pm'}) { + # (caller)[2] indicates the caller's line number, + # which is zero when the current thread is joining (destroying). + return if( (caller)[2] == 0); + } + + # clean up mortal anonymous class stuff + + # @ISA is a magical variable, so we must clear it manually. @{$self->{superclasses}} = () if exists $self->{superclasses}; # Then, clear the symbol table hash @@ -293,10 +304,8 @@ sub DESTROY{ delete $METAS{$name}; $name =~ s/ $serial_id \z//xms; - no strict 'refs'; delete ${$name}{ $serial_id . '::' }; - return; } @@ -319,11 +328,15 @@ __END__ =head1 NAME -Mouse::Meta::Module - The base class for Mouse::Meta::Class and Mouse::Meta::Role +Mouse::Meta::Module - The common base class of Mouse::Meta::Class and Mouse::Meta::Role =head1 VERSION -This document describes Mouse version 0.52 +This document describes Mouse version 0.70 + +=head1 DESCRIPTION + +This class is an abstract base class of meta classes and meta roles. =head1 SEE ALSO