or: $0 [-w] [-u] [-n ntargs] [-o otherargs] [-s stripsuffix] [files]
-n ntargs arguments to invoke perl with in generated file
when run from Windows NT. Defaults to
- '-x -S "%0" %*'.
+ '-x -S %0 %*'.
-o otherargs arguments to invoke perl with in generated file
other than when run from Windows NT. Defaults
to '-x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9'.
my %OPT = ();
warn($usage), exit(0) if !getopts('whun:o:a:s:',\%OPT) or $OPT{'h'};
-$OPT{'n'} = '-x -S "%0" %*' unless exists $OPT{'n'};
+# NOTE: %0 is already enclosed in doublequotes by cmd.exe, as appropriate
+$OPT{'n'} = '-x -S %0 %*' unless exists $OPT{'n'};
$OPT{'o'} = '-x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9' unless exists $OPT{'o'};
$OPT{'s'} = '/\\.plx?/' unless exists $OPT{'s'};
$OPT{'s'} = ($OPT{'s'} =~ m#^/([^/]*[^/\$]|)\$?/?$# ? $1 : "\Q$OPT{'s'}\E");
The generated batch file is initially processed as a batch file each
time it is run. This means that, to use it from within another batch
-file you should preceed it with C<call> or else the calling batch
+file you should precede it with C<call> or else the calling batch
file will not run any commands after the script:
call script [args]
One approach is:
- #!perl
- while( <DATA> ) {
- last if /^__END__$/;
- [...]
- }
- __END__
- lines of data
- to be processed
- __END__
- :endofperl
+ . #!perl
+ . while( <DATA> ) {
+ . last if /^__END__$/;
+ . [...]
+ . }
+ . __END__
+ . lines of data
+ . to be processed
+ . __END__
+ . :endofperl
+
+The dots in the first column are only there to prevent F<cmd.exe> to interpret
+the C<:endofperl> line in this documentation. Otherwise F<pl2bat.bat> itself
+wouldn't work. See the previous item. :-)
=item The batch file always "succeeds"
=item B<-n> I<ntargs>
Arguments to invoke perl with in generated batch file when run from
-Windows NT (or Windows 98, probably). Defaults to S<'-x -S "%0" %*'>.
+Windows NT (or Windows 98, probably). Defaults to S<'-x -S %0 %*'>.
=item B<-o> I<otherargs>