The following module was proposed for inclusion in the Module List:
modid: ReleaseAction
DSLI: bdph
description: Trigger actions on destruction of a handle
userid: TILLY (Ben Tilly)
chapterid: 20 (Control_Flow_Utilities)
communities:
http://www.perlmonks.org/index.pl?node_id=72887
similar:
SelectSaver
rationale:
I called this ReleaseAction because it sets up actions that will
fire when something is released.
This makes it trivial to take advantage of reliable destructors to
have a customized action take place on destruction of an object
without having to write a class with a constructor and destructor.
For instance the functionality of SelectSaver as a one-liner:
{ my $hold_select = on_release {select shift} select FILE; # *FILE
is selected but we will revert to the old # selection at the end of
the block }
I called this ReleaseAction because it creates an action that is
fired upon release. I do not see any modules that provide similar
functionality, and I do not think that there will be any modules
built on it. So I chose a name in the root space. But I would be
happy to change it to any other name that people think a better fit.
I am submitting it for consideration on CPAN mostly because Randal
Schwartz' first reaction on seeing it was to ask whether I was
planning to do that. I think that it is useful enough to justify
listing because it nicely encapsulates most of the things that I
think people need reliable destruction mechanics for in production
code (as opposed to debugging).
enteredby: TILLY (Ben Tilly)
enteredon: Sun Apr 22 22:40:26 2001 GMT
The resulting entry would be:
ReleaseAction bdph Trigger actions on destruction of a handle TILLY
Thanks for registering,
The Pause Team
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
http://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=d1000000_36b6103124cbbeb2&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
http://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=d1000000_36b6103124cbbeb2&SUBMIT_pause99_add_mod_insertit=1