develooper Front page | perl.perl5.porters | Postings from March 2000

[PATCH 5.6.0] perlmod.pod

From:
Peter Scott
Date:
March 23, 2000 13:20
Subject:
[PATCH 5.6.0] perlmod.pod
Message ID:
4.2.2.20000323130152.00adb690@mail.psdt.com
Quoth perlmod:

        ... END blocks are not executed when you run perl with the -c
        switch.
	...
        When you use the -n and -p switches to Perl, BEGIN and END
        work just as they do in awk, as a degenerate case.  As
        currently implemented (and subject to change, since its
        inconvenient at best), both BEGIN and<END> blocks are run
        when you use the -c switch for a compile-only syntax
        check, although your main code is not.

This latter point appears to be incorrect wrt END blocks:

$ echo "foo" | ./perl -cne 'BEGIN{print "In BEGIN\n"} END{print"In END\n"}'
In BEGIN
-e syntax OK
$

I'm guessing that perl is right and the comment in perlmod is vestigial, hence:

--- perlmod.pod.orig    Thu Mar 23 12:54:10 2000
+++ perlmod.pod Thu Mar 23 13:00:47 2000
@@ -252,8 +252,8 @@

  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.  As currently
-implemented (and subject to change, since its inconvenient at best),
-both C<BEGIN> and<END> blocks are run when you use the B<-c> switch
+implemented (and subject to change, since it's inconvenient at best),
+C<BEGIN> blocks are run when you use the B<-c> switch
  for a compile-only syntax check, although your main code is not.

  =head2 Perl Classes


--
Peter Scott
Pacific Systems Design Technologies




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About