develooper Front page | perl.perl5.porters | Postings from December 2004

Re: [perl #32714] Objects destroyed in the wrong order during global destruction

Thread Previous | Thread Next
Elizabeth Mattijsen
December 3, 2004 02:22
Re: [perl #32714] Objects destroyed in the wrong order during global destruction
Message ID:
At 11:20 PM -0800 12/2/04, Yitzchak Scott-Thoennes wrote:
>On Fri, Dec 03, 2004 at 01:01:20AM +0100, Paul Johnson <> wrote:
>>  Devel::Cover does just this.  It's something of an unholy mix of XS and
>>  perl subs for various arcane reasons, at least some of which are
>>  unlikely to be valid any more.
>>  The way it works is that in a CHECK block an XS sub is called which
>>  installs a perl sub as as the first END sub.  This is done by unshifting
>>  onto PL_endav.  When that sub is called as the first END sub it calls
>>  another XS sub which installs another perl sub as the last END sub by
>>  pushing it onto PL_endav.  That newly installed sub should be the last
>>  END sub called.  Unless one of the subsequent END subs installs another
>>  END sub.
>Does the first END sub do something else also?  Why not skip the CHECK
>and just have a regular END sub that inserts a last END sub?

That would be my plan, yes.

>No dedicated XS needed, at least as of 5.8.1:
>perl -we'use B qw/end_av/; END { print "baz" } END {print "bar"; 
>push @{end_av()->object_2svref}, sub { print "quux" } } END { print 
>"foo" }'

Wow.  But is having B as a prerequisite a good idea?


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About