I can't recall the name of the module that lets me associate a destructor with a specific thing. I've got an Archive::Extract object which has been extracted out to a temporary directory. I'd like to remove the directory as soon as the last reference to it is gone. The code to do this is simple enough and the need common enough that I'm sure it's already on CPAN but that I just can't recall the name. Help?
$tmpdir = File::Temp::tmpdir(); $archive = Archive::Extract->new( archive => ... ); $archive->extract( to => $tmpdir ); # Hooks DESTROY for this object. $archive = on_cleanup( $archive, sub { # rm -rf $tmpdir } );
⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊
In reply to Per-object DESTROY by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |