implement STOP blocks and fix compiler to use them (minimally
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
index da1425e..e46df77 100644 (file)
@@ -24,6 +24,12 @@ responsibility to ensure that warnings are enabled judiciously.
 
 =over 4
 
+=item STOP is a new keyword
+
+In addition to C<BEGIN>, C<INIT> and C<END>, subroutines named
+C<STOP> are now special.  They are queued up for execution at the
+end of compilation, and cannot be called directly.
+
 =item Treatment of list slices of undef has changed
 
 When taking a slice of a literal list (as opposed to a slice of
@@ -603,6 +609,13 @@ BEGIN blocks are executed under such conditions, this variable
 enables perl code to determine whether actions that make sense
 only during normal running are warranted.  See L<perlvar>.
 
+=head2 STOP blocks
+
+Arbitrary code can be queued for execution when Perl has finished
+parsing the program (i.e. when the compile phase ends) using STOP
+blocks.  These behave similar to END blocks, except for being
+called at the end of compilation rather than at the end of execution.
+
 =head2 Optional Y2K warnings
 
 If Perl is built with the cpp macro C<PERL_Y2KWARN> defined,
@@ -789,9 +802,7 @@ run in compile-only mode.  Since this is typically not the expected
 behavior, END blocks are not executed anymore when the C<-c> switch
 is used.
 
-Note that something resembling the previous behavior can still be
-obtained by putting C<BEGIN { $^C = 0; exit; }> at the very end of
-the top level source file.
+See L<STOP blocks> for how to run things when the compile phase ends.
 
 =head2 Potential to leak DATA filehandles