summaryrefslogtreecommitdiff
path: root/pod/perlmod.pod
diff options
context:
space:
mode:
authorChas. J. Owens IV <chas.owens@gmail.com>2010-11-02 10:28:54 -0400
committerFlorian Ragwitz <rafl@debian.org>2010-11-14 17:18:05 +0100
commit191f4b8c3ced80a9e7249fdf6d5039ad8133bb0a (patch)
tree5d109e342ae59b0230793500109406b32df8b581 /pod/perlmod.pod
parent9e923162438e0df7622d029d15fec76ef05799bd (diff)
downloadperl-191f4b8c3ced80a9e7249fdf6d5039ad8133bb0a.tar.gz
add example for ${^GLOBAL_PHASE} and description to perlmod
Signed-off-by: Florian Ragwitz <rafl@debian.org> [rafl@debian.org: Minor rewording based on input from TIMB]
Diffstat (limited to 'pod/perlmod.pod')
-rw-r--r--pod/perlmod.pod11
1 files changed, 11 insertions, 0 deletions
diff --git a/pod/perlmod.pod b/pod/perlmod.pod
index 8679b53e88..90655867c9 100644
--- a/pod/perlmod.pod
+++ b/pod/perlmod.pod
@@ -294,6 +294,9 @@ value of the program. Beware of changing C<$?> by accident (e.g. by
running something via C<system>).
X<$?>
+Inside of a C<END> block, the value of C<${^GLOBAL_PHASE}> will be
+C<"END">.
+
C<UNITCHECK>, C<CHECK> and C<INIT> code blocks are useful to catch the
transition between the compilation phase and the execution phase of
the main program.
@@ -304,13 +307,21 @@ compilation units, as are string C<eval>s, code compiled using the
C<(?{ })> construct in a regex, calls to C<do FILE>, C<require FILE>,
and code after the C<-e> switch on the command line.
+C<BEGIN> and C<UNITCHECK> blocks are not directly related to the phase of
+the interpreter. They can be created and executed during any phase.
+
C<CHECK> code blocks are run just after the B<initial> Perl compile phase ends
and before the run time begins, in LIFO order. C<CHECK> code blocks are used
in the Perl compiler suite to save the compiled state of the program.
+Inside of a C<CHECK> block, the value of C<${^GLOBAL_PHASE}> will be
+C<"CHECK">.
+
C<INIT> blocks are run just before the Perl runtime begins execution, in
"first in, first out" (FIFO) order.
+Inside of an C<INIT> block, the value of C<${^GLOBAL_PHASE}> will be C<"INIT">.
+
The C<CHECK> and C<INIT> blocks in code compiled by C<require>, string C<do>,
or string C<eval> will not be executed if they occur after the end of the
main compilation phase; that can be a problem in mod_perl and other persistent