CC: | jkeenan [...] cpan.org |
Subject: | Invalid code in a2p appears when using exit function in BEGIN {} section |
The report below was originally filed in February 2012 in the Perl 5 bug queue at https://rt.perl.org/Ticket/Display.html?id=110606.
Since a2p is now maintained on CPAN, I am transferring the report to this queue.
Thank you very much.
Jim Keenan
##############
This is a bug report for perl from glitchmr@myopera.com,
generated with the help of perlbug 1.39 running under perl 5.14.2.
-----------------------------------------------------------------
[Please describe your issue here]
If the script sent to a2p uses 'BEGIN {exit}', a2p will generate 'last
line', which causes awk to end with error without parsing every file line and
'END { }' section.
BEGIN {exit}
END { print "This should run!" }
Creates invalid Perl code which will make error instead of printing text:
#!perl
eval 'exec
C:\cygwin\home\gecko\tmp\perl-kpnbcrjndjmsxgdxbdoyvuagpsxapvmlmn\bin/perl -S
$0 ${1+"$@"}'
if $running_under_some_shell;
# this emulates #! processing on NIH machines.
# (remove #! line above if indigestible)
eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
# process any FOO=bar switches
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
last line;
print 'This should run!';
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=utilities
severity=medium
---
Site configuration information for perl 5.14.2:
Configured by sshd_server at Fri Oct 7 15:14:49 2011.
Summary of my perl5 (revision 5 version 14 subversion 2) configuration:
Platform:
osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='C:/mingw/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS
-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields',
optimize='-O2',
cppflags='-DWIN32'
ccversion='', gccversion='4.6.1', gccosandvers=''
intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='__int64', ivsize=8, nvtype='double', nvsize=8,
Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='C:\mingw\bin\g++.exe', ldflags ='-L"C:\Perl64\lib\CORE"'
libpth=\lib
libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm
-lversion -lodbc32 -lodbccp32 -lcomctl32 -lbufferoverflowU -lmsvcrt
perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm
-lversion -lodbc32 -lodbccp32 -lcomctl32 -lbufferoverflowU -lmsvcrt
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl514.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -L"C:\Perl64\lib\CORE"'
Locally applied patches:
ACTIVEPERL_LOCAL_PATCHES_ENTRY
---
@INC for perl 5.14.2:
C:/Perl64/site/lib
C:/Perl64/lib
.
---
Environment for perl 5.14.2:
HOME=C:\Users\Konrad
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\Program Files (x86)\ActiveState Komodo IDE
7\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\PHP\;C:\Program
Files (x86)\ATI Stream\bin\x86_64;C:\Program Files (x86)\ATI
Stream\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Parrot-3.8.0\bin;c:\rakudo\bin;C:\Program
Files
(x86)\Zend\MySQL51\bin;C:\Users\Konrad\AppData\Roaming\npm;C:\Program
Files (x86)\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files
(x86)\Git\bin;C:\Program Files (x86)\Heroku;C:\Program Files
(x86)\git\bin;C:\Program Files
(x86)\git\cmd;C:\Ruby193\bin;C:\Tcl\bin;C:\Program Files (x86)\ActiveState
Komodo IDE 7\;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files
(x86)\PHP\;C:\Program Files (x86)\ATI Stream\bin\x86_64;C:\Program Files
(x86)\ATI
Stream\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Parrot-3.8.0\bin;c:\rakudo\bin;C:\Program
Files
(x86)\Zend\MySQL51\bin;C:\Users\Konrad\AppData\Roaming\npm;C:\Program
Files (x86)\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files
(x86)\Git\bin;C:\Program Files (x86)\Heroku;C:\Program Files
(x86)\git\bin;C:\Program Files
(x86)\git\cmd;C:\xampp\htdocs\lib\Cake\Console;C:\mingw\bin;C:\KDE\bin;C:\Python32;C:\android-sdk-windows\platform-tools;C:\android-sdk-windows\tools
PERL_BADLANG (unset)
PERL_JSON_BACKEND=JSON::XS
PERL_YAML_BACKEND=YAML
SHELL (unset)