in reply to Pseudo End

Try ReleaseAction.

Replies are listed 'Best First'.
Re: Re: Pseudo End
by Rhandom (Curate) on Apr 25, 2001 at 00:22 UTC
    For the record, I see ReleaseAction was checked in on April 22. We have been using our's since mid march (here is our cvs log)
    RCS file: /ourrepositorypath/End.pm,v Working file: End.pm head: 1.3 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: ---------------------------- revision 1.3 date: 2001/04/05 17:18:46; author: pauls; state: Exp; lines: +8 -8 updated to store subs to execute inside of itself - the other way coul +d have caused some weird results in mod perl\ loops if an object never destroyed ---------------------------- revision 1.2 date: 2001/03/16 17:53:36; author: pauls; state: Exp; lines: +21 -1 added perldoc ---------------------------- revision 1.1 date: 2001/03/16 17:46:30; author: pauls; state: Exp; initial entry
    Not that this matters or anything.
    my @a=qw(random brilliant braindead); print $a[rand(@a)];
Re: Re: Pseudo End
by Rhandom (Curate) on Apr 25, 2001 at 00:15 UTC
    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)];
      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.