Permalink
Browse files

Document BEGIN, END, etc. in perlsyn

This adds a brief note that blocks can be preceded by a
compilation phase keyword and points the reader to
perlmod for the gory details.
  • Loading branch information...
xdg committed Sep 30, 2011
1 parent 4daf280 commit 43f66a7639829d7bd7a355e847c3ce0379062a94
Showing with 5 additions and 0 deletions.
  1. +5 −0 pod/perlsyn.pod
View
@@ -239,6 +239,7 @@ The following compound statements may be used to control flow:
LABEL foreach VAR (LIST) BLOCK
LABEL foreach VAR (LIST) BLOCK continue BLOCK
LABEL BLOCK continue BLOCK
+ PHASE BLOCK
Note that, unlike C and Pascal, these are defined in terms of BLOCKs,
not statements. This means that the curly brackets are I<required>--no
@@ -279,6 +280,10 @@ conditional is about to be evaluated again. Thus it can be used to
increment a loop variable, even when the loop has been continued via
the C<next> statement.
+When a block is preceding by a compilation phase keyword such as C<BEGIN>,
+C<END>, C<INIT>, C<CHECK>, or C<UNITCHECK>, then the block will run only
+during the corresponding phase of execution. See L<perlmod> for more details.
+
Extension modules can also hook into the Perl parser to define new
kinds of compound statement. These are introduced by a keyword which
the extension recognizes, and the syntax following the keyword is

0 comments on commit 43f66a7

Please sign in to comment.