in reply to Re: Pseudo End
in thread Pseudo End

Um.... Oh... Yeah. I see. Well, ReleaseAction. Nice piece of code.

Rats. First attempt at posting craft and it's been done. Oh well. Maybe next time. As for a comparison, he allows a method call. I allow multiple subs. I should send tilly a patch or something.

my @a=qw(random brilliant braindead); print $a[rand(@a)];

Replies are listed 'Best First'.
Re (tilly) 3: Pseudo End
by tilly (Archbishop) on Apr 25, 2001 at 02:18 UTC
    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.