From: Peter Rabbitson Date: Wed, 8 Aug 2012 22:59:22 +0000 (+0200) Subject: Work around a rather bizzare effect of compile flag THREADS_HAVE_PIDS X-Git-Tag: Devel-GlobalDestruction-0.09~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df69e815211456320c2b4599135f4e3681c8f63b;p=p5sagit%2FDevel-GlobalDestruction.git Work around a rather bizzare effect of compile flag THREADS_HAVE_PIDS --- diff --git a/lib/Devel/GlobalDestruction.pm b/lib/Devel/GlobalDestruction.pm index 528fdac..3bb0b7c 100644 --- a/lib/Devel/GlobalDestruction.pm +++ b/lib/Devel/GlobalDestruction.pm @@ -81,7 +81,15 @@ if ($INC{'threads.pm'}) { @_ = ( $class, - sub { $add_endblock->(); goto $target }, + sub { + # Perls compiled with THREADS_HAVE_PIDS do not copy end_av properly + # between threads, so B::end_av ends up returning a B::SPECIAL and it + # goes downhill from there + # Install a noop END just to be on the safe side + { local $@; eval 'END {}' } + $add_endblock->(); + goto $target + }, @_, );