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 undefined if none of the four apply.
undef
All of the functions listed here are importable. The import tag :in may be used to name all the functions beginning with in_.
:in
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.
1 POD Error
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back 4
To install Perl::WhichPhase, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::WhichPhase
CPAN shell
perl -MCPAN -e shell install Perl::WhichPhase
For more information on module installation, please visit the detailed CPAN module installation guide.