develooper Front page | perl.perl5.porters | Postings from July 2009

rewording a paragraph in perlmod.pod for clarity

Thread Next
David Nicol
July 23, 2009 14:32
rewording a paragraph in perlmod.pod for clarity
Message ID:
I had to read this several times before what it meant sank in. I thought
this document was
telling me that a syntax error in a BEGIN or UNITCHECK would not stop the
compiler, which
was kind of stunning.

index 3d5f3ad..e4b6136 100644
--- a/pod/perlmod.pod
+++ b/pod/perlmod.pod
@@ -273,10 +273,10 @@ 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.
+It should be noted that when they appear in strings (not blocks)
+evaluated by C<eval>, C<BEGIN> and C<UNITCHECK> code blocks do get run,
+while C<CHECK> and C<INIT> code blocks do not. This can lead to surprise,
+such as in the 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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About