Skip Menu |
Report information
Id: 1007
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: Steve.Tolkin [at] fmr.com
Cc:
AdminCc:

Operating System: mswin32
PatchStatus: (no value)
Severity: medium
Type: bounce
Perl Version: 5.005_02
Fixed In: (no value)



From: "Tolkin, Steve" <Steve.Tolkin [...] fmr.com>
To: "'perlbug [...] perl.com'" <perlbug [...] perl.com>
Cc: "'tolkin [...] mediaone.net'" <tolkin [...] mediaone.net>
Subject: Bug in pl2bat if last line of input is a comment that does not en d with a newline
Date: Fri, 16 Jul 1999 10:59:57 -0400
Download (untitled) / with headers
text/plain 3.6k
----------------------------------------------------------------- [Please enter your report here] The pl2bat script is used on Microsoft Windows systems to create a batch file from a Perl file. There is a bug in pl2bat (i.e. pl2bat.bat, generated from pl2bat.pl) that occurs when the last line in the input file is a comment that does not end with a newline character. This bug occurs in all versions I have examined, including the Beta version 5.005_57. Here is a small testfile that will demonstrate the problem: #!/usr/bin/perl -w # This file runs successfully when invoked via: perl thisfile # But it will fail with a syntax error if you first run: pl2bat thisfile # and then say: thisfile print "If you see this it is OK\n"; # Because the last line is a comment, and it does not end with a newline # it "captures: the __END__ statement, causing a syntax error. # The fix is simple -- have pl2bat insert a newline before # writing the __END__ line. # The last line in this file is a comment that does not end with a newline In the generated file you will see near the end: # The last line in this file is a comment that does not end with a newline__END__ and so the __END__ marker is not found. Here is my suggested bug fix. In pl2bat.pl add a newline character just before __END__, i.e. change from: my $tail = "__END__\n:endofperl\n"; to: my $tail = "\n__END__\n:endofperl\n"; [Please do not change anything below this line] ----------------------------------------------------------------- --- Site configuration information for perl 5.00502: Summary of my perl5 (5.0 patchlevel 5 subversion 02) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-object uname='' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cl.exe', optimize='-O2 -MD -DNDEBUG -TP -GX', gccversion= cppflags='-DWIN32' ccflags ='-O2 -MD -DNDEBUG -TP -GX -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_OBJECT' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -release -machine:x86' libpth="C:\Perl\lib\core" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib PerlCRT.lib libc=C:\Perl\lib\core\PerlCRT.lib, so=dll, useshrplib=yes, libperl=perlcore.lib Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -machine:x86' Locally applied patches: --- @INC for perl 5.00502: C:\Perl\lib C:\Perl\site\lib . --- Environment for perl 5.00502: HOME (unset) LANG (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\Perl\bin;C:\WINNT\system32;C:\WINNT;C:\PROGRAM FILES\INFORMIX\BIN;C:\WINNT\system32\nls\ENGLISH;C:\WINNT\system32\nls;C:\IN FORMIX\BIN;;c:\orawin\bin;J:\ARTEMIS;c:\emacs\emacs-20.3.1\bin;c:\gnu;c:\cvs \bin;Z:.;Y:.;;C:\CVS\BIN PERL5DB=BEGIN { require 'C:\Program Files\ActiveState Perl Debugger\PerlDB.pl' } PERL_BADLANG (unset) SHELL (unset) Hopefully helpfully yours, Steve --- Steve Tolkin steve.tolkin@fmr.com 617-563-0516 Fidelity Investments 82 Devonshire St. R24D Boston MA 02109 There is nothing so practical as a good theory. Comments are by me, not Fidelity Investments, its subsidiaries or affiliates.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org