New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sub END not called after some compile errors #1879
Comments
From @aiganCreated by jonas@astral.paranormal.o.seThere is a incinsistent change of behaviour between v5.005_03 and v5.6.0 Only v5.005_03 calls END for this: #!/usr/local/bin/perl But both calls END for this compile error: #!/usr/local/bin/perl I would prefere the END to be called so that it could clean up all Perl Info
|
From @tamiasOn Mon, Apr 24, 2000 at 05:36:34PM +0200, Jonas Liljegren wrote:
That one's a runtime error, not a compile error. It's compiled as Ronald |
From [Unknown Contact. See original ticket]jonas@paranormal.o.se (Jonas Liljegren) wrote
This is a deliberate change. From "perldoc perldelta": END blocks and the `-c' switch Prior versions used to run BEGIN and END blocks when Perl Hmmm.. wait a moment - that doesn't actually cover the case you quote. Mike Guy Inline Patch--- ./pod/perldelta.pod.orig Mon Apr 24 17:28:32 2000
+++ ./pod/perldelta.pod Mon Apr 24 17:04:39 2000
@@ -1811,7 +1811,7 @@
Prior versions used to run BEGIN B<and> END blocks when Perl was
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.
+is used, or if compilation fails.
See L<CHECK blocks> for how to run things when the compile phase ends.
--- ./pod/perlmod.pod.orig Mon Mar 13 21:25:37 2000
+++ ./pod/perlmod.pod Mon Apr 24 17:29:42 2000
@@ -233,7 +233,7 @@
(if you can).) You may have multiple C<END> blocks within a file--they
will execute in reverse order of definition; that is: last in, first
out (LIFO). C<END> blocks are not executed when you run perl with the
-C<-c> switch.
+C<-c> switch, or if compilation fails..
Inside an C<END> subroutine, C<$?> contains the value that the program is
going to pass to C<exit()>. You can modify C<$?> to change the exit
@@ -252,7 +252,7 @@
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),
+implemented (and subject to change, since it's inconvenient at best),
both C<BEGIN> and<END> blocks are run when you use the B<-c> switch
for a compile-only syntax check, although your main code is not.
End of patch |
From @aigan"M.J.T. Guy" wrote:
Why should END not be called? I am using that behaviour in a module that checks STDERR: CGI::Debug program.cgi: #!/usr/bin/perl -w CGI/Debug.pm (in theory): package CGI::Debug; (But the whole thing is about 1000 lines...) Why shouldn't I be able to do this now? The main idea of the module was that I could just put the /jonas |
From [Unknown Contact. See original ticket]
Because in 5.6.0, then end-of-compilation phase is CHECK{}, not END{},
Here is the 5.6.0 way of doing that: BEGIN { # Start of compilation phase; put this at the top of the file. INIT { # Start of run time |
From @iabynDoesn't appear to be a bug. |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#3147 (status was 'resolved')
Searchable as RT3147$
The text was updated successfully, but these errors were encountered: