Perl::WhichPhase
use Perl::WhichPhase qw- :in block -; if(block eq 'BEGIN') { print "We are in a BEGIN block\n"; } if(in_END) { print "We are finishing up\n"; }
This module allows determination of the phase the Perl compiler and interpreter are in, one of BEGIN, INIT, END, or CHECK, or undef
ined if none of the four apply.
All of the functions listed here are importable. The import tag :in
may be used to name all the functions beginning with in_
.
This will return one of the four strings BEGIN, INIT, END, or CHECK if Perl is current running that phase. If Perl is not running one of those phases, then this will return undef
.
This will return true of the code is being run in a BEGIN block.
This will return true of the code is being run in a CHECK block.
This will return true if the code is not being run in any of the four phases.
This will return true of the code is being run in an END block.
This will return true of the code is being run in an INIT block.
James G. Smith <jsmith@cpan.org>
Copyright (C) 2002 Texas A&M University. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.