diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-07-24 11:13:44 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-07-24 11:13:44 +0200 |
commit | 98107fc72616109aca5e0f235c7401288a09bd2f (patch) | |
tree | 5e08ec4f6812a75aee09f8b4b255e46fedb91b47 /pod/perlmod.pod | |
parent | 107bd1173cd0e834849d7ce5b0c1212929791181 (diff) | |
download | perl-98107fc72616109aca5e0f235c7401288a09bd2f.tar.gz |
Rephrase note about CHECK and INIT in eval("") in perlmod
(based on suggestions by David Nicol and chromatic)
Diffstat (limited to 'pod/perlmod.pod')
-rw-r--r-- | pod/perlmod.pod | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pod/perlmod.pod b/pod/perlmod.pod index 3d5f3ad0a4..4a7c62dfd0 100644 --- a/pod/perlmod.pod +++ b/pod/perlmod.pod @@ -273,11 +273,6 @@ and such from other files in time to be visible to the rest of the compile and run time. Once a C<BEGIN> has run, it is immediately undefined and any code it used is returned to Perl's memory pool. -It should be noted that C<BEGIN> and C<UNITCHECK> code blocks B<are> -executed inside string C<eval()>'s. The C<CHECK> and C<INIT> code -blocks are B<not> executed inside a string eval, which e.g. can be a -problem in a mod_perl environment. - An C<END> code block is executed as late as possible, that is, after perl has finished running the program and just before the interpreter is being exited, even if it is exiting as a result of a die() function. @@ -316,6 +311,11 @@ in the Perl compiler suite to save the compiled state of the program. C<INIT> blocks are run just before the Perl runtime begins execution, in "first in, first out" (FIFO) order. +The C<CHECK> and C<INIT> code blocks will not be executed inside a string +eval(), if that eval() happens after the end of the main compilation +phase; that can be a problem in mod_perl and other persistent environments +which use C<eval STRING> to load code at runtime. + When you use the B<-n> and B<-p> switches to Perl, C<BEGIN> and C<END> work just as they do in B<awk>, as a degenerate case. Both C<BEGIN> and C<CHECK> blocks are run when you use the B<-c> |