Name : perl-AtExit
| |
Version : 2.05
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.1.1
| Date : 2023-07-20 21:15:03
|
Group : Unspecified
| Source RPM : perl-AtExit-2.05-lp155.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : perform exit processing for a program or object
|
Description :
The *AtExit* module provides ANSI-C style exit processing modeled after the \'atexit\' function in the standard C library (see atexit(3C)). Various exit processing routines may be registered by calling *atexit* and passing it the desired subroutine along with any desired arguments. Then, at program-exit time, the subroutines registered with *atexit* are invoked with their given arguments in the _reverse_ order of registration (last one registered is invoked first). Registering the same subroutine more than once will cause that subroutine to be invoked once for each registration.
An *AtExit* object can be created in any scope. When invoked as a function, *atexit* registers callbacks to be executed at _program-exit_ time. But when invoked as an object-method (using the \'$object->method_name\' syntax), callbacks registered with an *AtExit* object are executed at _object-destruction time_! The rules for order of execution of the registered subroutines are the same for objects during object-destruction, as for the program during program-termination.
The *atexit* function/method should be passed a subroutine name or reference, optionally followed by the list of arguments with which to invoke it at program/object exit time. Anonymous subroutine references passed to *atexit* act as \"closures\" (which are described in perlref). If a subroutine _name_ is specified (as opposed to a subroutine reference) then, unless the subroutine name has an explicit package prefix, it is assumed to be the name of a subroutine in the caller\'s current package. A reference to the specified subroutine is obtained, and, if invocation arguments were specified, it is \"wrapped up\" in a closure which invokes the subroutine with the specified arguments. The resulting subroutine reference is added to the front of the list of exit-handling subroutines for the program (\'atexit\') or the *AtExit* object (\'$exitObject->atexit\') and the reference is then returned to the caller (just in case you might want to unregister it later using *rmexit*. If the given subroutine could _not_ be registered, then the value zero is returned.
The *rmexit* function/method should be passed one or more subroutine references, each of which was returned by a previous call to *atexit*. For each argument given, *rmexit* will look in the list of exit-handling subroutines for the program (*rmexit*) or the *AtExit* object (\'$exitObject->rmexit\') and remove the first matching entry from the list. If no arguments are given, _then all program or object exit-handlers are unregistered!_ The value returned will be the number of subroutines that were successfully unregistered.
At object destruction time, the \'DESTROY{}\' subroutine in the *AtExit* module iterates over the subroutine references in the *AtExit* object and invokes each one in turn (each subroutine is removed from the front of the queue immediately before it is invoked). At program-exit time, the \'END{}\' block in the *AtExit* module iterates over the subroutines in the array returned by the *exit_subs* method and invokes each one in turn (each subroutine is removed from the front of the queue immediately before it is invoked). Note that in both cases (program-exit, and object-destruction) the subroutines in this queue are invoked in first-to-last order (the _reverse_ order in which they were registered with *atexit*).
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-A/15.5/noarch |