in reply to Re: Re: Pseudo End
in thread Pseudo End

Store the release actions in an temporary array. When the array is freed, the actions will all fire. That is good enough for me.

I am wondering whether it would be useful, though, to be able to add to the list of arguments. For instance:

while (1) { my $end = on_release {warn $_ for @_} "Out of the loop"; # ... last if $cond; $end->add("Out of the loop 2"); # ... etc }
Yes? No? Maybe?

(I am not convinced that it is worthwhile, but I could easily become so if someone has a good reason to use that.) </code> BTW I was using the germ of this code a few months ago, though it improved before placement on CPAN.