Rechercher une page de manuel
Perl::AtEndOfScope.3pm
Langue: en
Version: 2005-05-31 (mandriva - 01/05/08)
Section: 3 (Bibliothèques de fonctions)
NAME
Perl::AtEndOfScope - run some code when a variable goes out of scopeSYNOPSIS
use Perl::AtEndOfScope; use Cwd; { my $restorecwd=Perl::AtEndOfScope->new( sub{chdir $_[0]}, getcwd ); chdir '/path/to/some/directory'; ... } # now we are back to the old cwd
DESCRIPTION
It's often necessary to do some cleanup at the end of a scope. This module creates a Perl object and executes arbitrary code when the object goes out of scope.METHODS
- Perl::AtEndOfScope->new( $sub, @args )
- the constructor. The code reference passed in $sub is called with @args as parameter list when the object is destroyed.
- DESTROY( $self )
- the destructor.
EXPORT
Not an Exporter.AUTHOR
Torsten Foertsch, <torsten.foertsch@gmx.net>COPYRIGHT AND LICENSE
Copyright (C) 2005 by Torsten FoertschThis library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre