win32/TEST Win32 port
win32/autosplit.pl Win32 port
win32/bin/network.pl Win32 port
-win32/bin/pl2bat.bat wrap perl scripts into batch files
-win32/bin/runperl.bat run perl script via batch file namesake
-win32/bin/search.bat Win32 port
-win32/bin/test.bat Win32 port
-win32/bin/webget.bat Win32 port
+win32/bin/pl2bat.pl wrap perl scripts into batch files
+win32/bin/runperl.pl run perl script via batch file namesake
+win32/bin/search.pl Win32 port
+win32/bin/webget.pl Win32 port
win32/bin/www.pl Win32 port
win32/config.bc Win32 base line config.sh (Borland C++ build)
win32/config.vc Win32 base line config.sh (Visual C++ build)
CONFIGPM=..\lib\Config.pm
MINIMOD=..\lib\ExtUtils\Miniperl.pm
-PL2BAT=bin\PL2BAT.BAT
-GLOBBAT = perlglob.bat
+PL2BAT=bin\pl2bat.pl
+GLOBBAT = bin\perlglob.bat
MAKE=nmake -nologo
CFGSH_TMPL = config.vc
$(GLOBEXE): perlglob.obj
$(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
-perlglob.bat : ..\lib\File\DosGlob.pm $(MINIPERL)
- $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(*B).bat
+$(GLOBBAT) : ..\lib\File\DosGlob.pm $(MINIPERL)
+ $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(GLOBBAT)
perlglob.obj : perlglob.c
utils: $(PERLEXE)
cd ..\utils
nmake PERL=$(MINIPERL)
- $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
- h2xs perldoc pstruct
+ $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph
+ $(PERLEXE) ..\win32\$(PL2BAT) h2xs perldoc pstruct
$(XCOPY) *.bat ..\win32\bin\*.*
cd ..\win32
+ $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
+ bin\pl2bat.pl
distclean: clean
-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
$(DYNALOADER).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
+ -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \
+ config.h.new perl95.c
+ -del /f bin\*.bat
-rmdir /s /q ..\lib\auto
-rmdir /s /q ..\lib\CORE
cd $(EXTDIR)
$(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
$(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
- $(XCOPY) $(GLOBBAT) $(INST_BIN)\*.*
$(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
- $(XCOPY) bin\*.* $(INST_BIN)\*.*
+ $(XCOPY) bin\*.bat $(INST_BIN)\*.*
$(RCOPY) ..\lib $(INST_LIB)\*.*
$(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
$(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
-@erase $(CORE_OBJ)
-@erase $(WIN32_OBJ)
-@erase $(DLL_OBJ)
- -@erase ..\*.obj *.obj ..\*.lib ..\*.exp
+ -@erase ..\*.obj ..\*.lib ..\*.exp *.obj *.lib *.exp
+ -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
-@erase *.ilk
-@erase *.pdb
+++ /dev/null
-@rem = '--*-Perl-*--
-@echo off
-perl -x -S %0 %*
-goto endofperl
-@rem ';
-#!perl -w
-#line 8
-(my $head = <<'--end--') =~ s/^\t//gm;
- @rem = '--*-Perl-*--
- @echo off
- perl -x -S %0 %*
- goto endofperl
- @rem ';
---end--
-my $headlines = 2 + ($head =~ tr/\n/\n/);
-my $tail = "__END__\n:endofperl\n";
-
-@ARGV = ('-') unless @ARGV;
-
-process(@ARGV);
-
-sub process {
- LOOP:
- foreach ( @_ ) {
- my $myhead = $head;
- my $linedone = 0;
- my $linenum = $headlines;
- my $line;
- open( FILE, $_ ) or die "Can't open $_: $!";
- @file = <FILE>;
- foreach $line ( @file ) {
- $linenum++;
- if ( $line =~ /^:endofperl/) {
- warn "$_ has already been converted to a batch file!\n";
- next LOOP;
- }
- if ( not $linedone and $line =~ /^#!.*perl/ ) {
- $line .= "#line $linenum\n";
- $linedone++;
- }
- }
- close( FILE );
- s/\.pl$//;
- $_ .= '.bat' unless /\.bat$/ or /^-$/;
- open( FILE, ">$_" ) or die "Can't open $_: $!";
- print FILE $myhead;
- print FILE "#!perl\n#line " . ($headlines+1) . "\n" unless $linedone;
- print FILE @file, $tail;
- close( FILE );
- }
-}
-__END__
-
-=head1 NAME
-
-pl2bat.bat - a batch file to wrap perl code into a batch file
-
-=head1 SYNOPSIS
-
- C:\> pl2bat foo.pl bar
- [..creates foo.bat, bar.bat..]
-
- C:\> pl2bat < somefile > another.bat
-
- C:\> pl2bat > another.bat
- print scalar reverse "rekcah lrep rehtona tsuj\n";
- ^Z
- [..another.bat is now a certified japh application..]
-
-=head1 DESCRIPTION
-
-This utility converts a perl script into a batch file that can be
-executed on DOS-like operating systems.
-
-Note that the ".pl" suffix will be stripped before adding a
-".bat" suffix to the supplied file names.
-
-The batch file created makes use of the C<%*> construct to refer
-to all the command line arguments that were given to the batch file,
-so you'll need to make sure that works on your variant of the
-command shell. It is known to work in the cmd.exe shell under
-WindowsNT. 4DOS/NT users will want to put a C<ParameterChar = *>
-line in their initialization file, or execute C<setdos /p*> in
-the shell startup file.
-
-=head1 BUGS
-
-C<$0> will contain the full name, including the ".bat" suffix.
-If you don't like this, see runperl.bat for an alternative way to
-invoke perl scripts.
-
-Perl is invoked with the -S flag, so it will search the PATH to find
-the script. This may have undesirable effects.
-
-=head1 SEE ALSO
-
-perl, perlwin32, runperl.bat
-
-=cut
-
-__END__
-:endofperl
-
--- /dev/null
+#!perl -w
+require 5;
+use Getopt::Std;
+
+$0 =~ s|.*[/\\]||;
+
+my $usage = <<EOT;
+Usage: $0 [-h] [-a argstring] [-s stripsuffix] [files]
+ -a argstring arguments to invoke perl with in generated file
+ Defaults to "-x -S %0 %*" on WindowsNT,
+ "-x -S %0 %1 %2 %3 %4 %5 %6 %7 %8 %9" otherwise
+ -s stripsuffix strip this suffix from file before appending ".bat"
+ Not case-sensitive
+ Can be a regex if it begins with `/'
+ Defaults to "/\.pl/"
+ -h show this help
+EOT
+
+my %OPT = ();
+warn($usage), exit(0) if !getopts('ha:s:',\%OPT) or $OPT{'h'};
+$OPT{'a'} = ($^O eq 'MSWin32' and &Win32::IsWinNT
+ ? '-x -S %0 %*'
+ : '-x -S %0 %1 %2 %3 %4 %5 %6 %7 %8 %9')
+ unless exists $OPT{'a'};
+$OPT{'s'} = '.pl' unless exists $OPT{'s'};
+$OPT{'s'} = ($OPT{'s'} =~ m|^/([^/]*)| ? $1 : "\Q$OPT{'s'}\E");
+
+(my $head = <<EOT) =~ s/^\t//gm;
+ \@rem = '--*-Perl-*--
+ \@echo off
+ perl $OPT{'a'}
+ goto endofperl
+ \@rem ';
+EOT
+my $headlines = 2 + ($head =~ tr/\n/\n/);
+my $tail = "__END__\n:endofperl\n";
+
+@ARGV = ('-') unless @ARGV;
+
+process(@ARGV);
+
+sub process {
+ LOOP:
+ foreach ( @_ ) {
+ my $myhead = $head;
+ my $linedone = 0;
+ my $linenum = $headlines;
+ my $line;
+ open( FILE, $_ ) or die "$0: Can't open $_: $!";
+ @file = <FILE>;
+ foreach $line ( @file ) {
+ $linenum++;
+ if ( $line =~ /^:endofperl/) {
+ warn "$0: $_ has already been converted to a batch file!\n";
+ next LOOP;
+ }
+ if ( not $linedone and $line =~ /^#!.*perl/ ) {
+ $line .= "#line $linenum\n";
+ $linedone++;
+ }
+ }
+ close( FILE );
+ s/$OPT{'s'}$//oi;
+ $_ .= '.bat' unless /\.bat$/i or /^-$/;
+ open( FILE, ">$_" ) or die "Can't open $_: $!";
+ print FILE $myhead;
+ print FILE "#!perl\n#line " . ($headlines+1) . "\n" unless $linedone;
+ print FILE @file, $tail;
+ close( FILE );
+ }
+}
+__END__
+
+=head1 NAME
+
+pl2bat - wrap perl code into a batch file
+
+=head1 SYNOPSIS
+
+B<pl2bat> [B<-h>] S<[B<-a> I<argstring>]> S<[B<-s> I<stripsuffix>]> [files]
+
+=head1 DESCRIPTION
+
+This utility converts a perl script into a batch file that can be
+executed on DOS-like operating systems.
+
+Note that by default, the ".pl" suffix will be stripped before adding
+a ".bat" suffix to the supplied file names. This can be controlled
+with the C<-s> option.
+
+The default behavior on WindowsNT is to generate a batch file that
+uses the C<%*> construct to refer to all the command line arguments
+that were given to it, so you'll need to make sure that works on your
+variant of the command shell. It is known to work in the cmd.exe shell
+under WindowsNT. 4DOS/NT users will want to put a C<ParameterChar = *>
+line in their initialization file, or execute C<setdos /p*> in
+the shell startup file. On Windows95 and other platforms a nine
+argument limit is imposed on command-line arguments given to the
+generated batch file, since they may not support C<%*> in batch files.
+This can be overridden using the C<-a> option.
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-a> I<argstring>
+
+Arguments to invoke perl with in generated batch file. Defaults to
+S<"-x -S %0 %*"> on WindowsNT, S<"-x -S %0 %1 %2 %3 %4 %5 %6 %7 %8 %9">
+on other platforms.
+
+=item B<-s> I<stripsuffix>
+
+Strip a suffix string from file name before appending a ".bat"
+suffix. The suffix is not case-sensitive. It can be a regex if it
+begins with `/' (the trailing '/' being optional. Defaults to ".pl".
+
+=item B<-h>
+
+Show command line usage.
+
+=back
+
+=head1 EXAMPLES
+
+ C:\> pl2bat foo.pl bar.PM
+ [..creates foo.bat, bar.PM.bat..]
+
+ C:\> pl2bat -s "/\.pl|\.pm/" foo.pl bar.PM
+ [..creates foo.bat, bar.bat..]
+
+ C:\> pl2bat < somefile > another.bat
+
+ C:\> pl2bat > another.bat
+ print scalar reverse "rekcah lrep rehtona tsuj\n";
+ ^Z
+ [..another.bat is now a certified japh application..]
+
+=head1 BUGS
+
+C<$0> will contain the full name, including the ".bat" suffix
+when the generated batch file runs. If you don't like this,
+see runperl.bat for an alternative way to invoke perl scripts.
+
+Default behavior is to invoke Perl with the -S flag, so Perl will
+search the PATH to find the script. This may have undesirable
+effects.
+
+=head1 SEE ALSO
+
+perl, perlwin32, runperl.bat
+
+=cut
+
-@rem = '--*-Perl-*--
-@echo off
-perl -x -S %0 %*
-goto endofperl
-@rem ';
#!perl -w
-#line 8
$0 =~ s|\.bat||i;
unless (-f $0) {
$0 =~ s|.*[/\\]||;
=head1 NAME
-runperl.bat - an "universal" batch file to run perl scripts
+runperl.bat - "universal" batch file to run perl scripts
=head1 SYNOPSIS
=cut
-__END__
-:endofperl
-
-@rem = '--*-Perl-*--';
-@rem = '
-@echo off
-perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
-goto endofperl
-@rem ';
#!/usr/local/bin/perl -w
'di';
'ig00';
.SH "LATEST SOURCE"
See http://www.wg.omron.co.jp/~jfriedl/perl/index.html
-__END__
-:endofperl
+++ /dev/null
-@rem = '
-@echo off
-if exist perl.exe goto perlhere
-echo Cannot run without perl.exe in current directory!! Did you build it?
-pause
-goto endofperl
-:perlhere
-if exist perlglob.exe goto perlglobhere
-echo Cannot run without perlglob.exe in current directory!! Did you build it?
-pause
-goto endofperl
-:perlglobhere
-perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
-goto endofperl
-@rem ';
-
-#Portions (C) 1995 Microsoft Corporation. All rights reserved.
-# Developed by hip communications inc., http://info.hip.com/info/
-
-
-# This is written in a peculiar style, since we're trying to avoid
-# most of the constructs we'll be testing for.
-
-$| = 1;
-
-if ($ARGV[0] eq '-v') {
- $verbose = 1;
- shift;
-}
-
-
-# WYT 1995-05-02
-chdir 't' if -f 't/TESTNT';
-
-
-if ($ARGV[0] eq '') {
-# @ARGV = split(/[ \n]/,
-# `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t lib/*.t`);
-# `ls base/*.t comp/*.t cmd/*.t io/*.t op/*.t lib/*.t`);
-
-# WYT 1995-05-02 wildcard expansion,
-# `perl -e "print( join( ' ', \@ARGV ) )" base/*.t comp/*.t cmd/*.t io/*.t op/*.t lib/*.t nt/*.t`);
-
-# WYT 1995-06-01 removed all dependency on perlglob
-# WYT 1995-11-28 hacked up to cope with braindead Win95 console.
- push( @ARGV, `dir/s/b base` );
- push( @ARGV, `dir/s/b comp` );
- push( @ARGV, `dir/s/b cmd` );
- push( @ARGV, `dir/s/b io` );
- push( @ARGV, `dir/s/b op` );
- push( @ARGV, `dir/s/b lib` );
- push( @ARGV, `dir/s/b nt` );
-
- grep( chomp, @ARGV );
- @ARGV = grep( /\.t$/, @ARGV );
- grep( s/.*t\\//, @ARGV );
-}
-
-$sharpbang = 0;
-
-$bad = 0;
-$good = 0;
-$total = @ARGV;
-while ($test = shift) {
- if ($test =~ /^$/) {
- next;
- }
- $te = $test;
-# chop off 't' extension
- chop($te);
- print "$te" . '.' x (15 - length($te));
- if ($sharpbang) {
- open(results,"./$test |") || (print "can't run.\n");
- } else {
- $switch = '';
-# open(results,"./perl$switch $test |") || (print "can't run.\n");
- open(results,"perl$switch $test |") || (print "can't run.\n");
- }
- $ok = 0;
- $next = 0;
- while (<results>) {
- if ($verbose) {
- print $_;
- }
- unless (/^#/||/^$/) {
- if (/^1\.\.([0-9]+)/) {
- $max = $1;
- $totmax += $max;
- $files += 1;
- $next = 1;
- $ok = 1;
- } else {
- $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
- if (/^ok (.*)/ && $1 == $next) {
- $next = $next + 1;
- } else {
- $ok = 0;
- }
- }
- }
- }
- $next = $next - 1;
- if ($ok && $next == $max) {
- print "ok\n";
- $good = $good + 1;
- } else {
- $next += 1;
- print "FAILED on test $next\n";
- $bad = $bad + 1;
- $_ = $test;
- if (/^base/) {
- die "Failed a basic test--cannot continue.\n";
- }
- }
-}
-
-if ($bad == 0) {
- if ($ok) {
- print "All tests successful.\n";
- } else {
- die "FAILED--no tests were run for some reason.\n";
- }
-} else {
- $pct = sprintf("%.2f", $good / $total * 100);
- if ($bad == 1) {
- warn "Failed 1 test, $pct% okay.\n";
- } else {
- die "Failed $bad/$total tests, $pct% okay.\n";
- }
-}
-
-
-# WYT 1995-05-03 times not implemented.
-#($user,$sys,$cuser,$csys) = times;
-#print sprintf("u=%g s=%g cu=%g cs=%g files=%d tests=%d\n",
-# $user,$sys,$cuser,$csys,$files,$totmax);
-
-#`del /f Cmd_while.tmp Comp.try null 2>NULL`;
-
-unlink 'Cmd_while.tmp', 'Comp.try', 'null';
-
-__END__
-:endofperl
-@rem = '--*-Perl-*--';
-@rem = '
-@echo off
-perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
-goto endofperl
-@rem ';
#!/usr/local/bin/perl -w
#-
}
__END__
-__END__
-:endofperl
CONFIGPM=..\lib\Config.pm
MINIMOD=..\lib\ExtUtils\Miniperl.pm
-PL2BAT=bin\PL2BAT.BAT
-GLOBBAT = perlglob.bat
+PL2BAT=bin\pl2bat.pl
+GLOBBAT = bin\perlglob.bat
.IF "$(CCTYPE)" == "BORLAND"
$(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
.ENDIF
-perlglob.bat : ..\lib\File\DosGlob.pm $(MINIPERL)
- $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(*B).bat
+$(GLOBBAT) : ..\lib\File\DosGlob.pm $(MINIPERL)
+ $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(GLOBBAT)
perlglob.obj : perlglob.c
cd ..\utils && $(MAKE) PERL=$(MINIPERL)
cd ..\utils && $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug \
pl2pm c2ph h2xs perldoc pstruct
- cd ..\utils && $(XCOPY) *.bat ..\win32\bin\*.*
+ $(XCOPY) ..\utils\*.bat bin\*.*
+ $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
+ bin\pl2bat.pl
distclean: clean
-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
$(DYNALOADER).c
-del /f $(PODDIR)\*.html
-del /f $(PODDIR)\*.bat
+ -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
+.IF "$(PERL95EXE)" != ""
+ -del /f perl95.c
+.ENDIF
+ -del /f bin\*.bat
-cd $(EXTDIR) && del /s *.lib *.def *.map *.bs Makefile *.obj pm_to_blib
-rmdir /s /q ..\lib\auto
-rmdir /s /q ..\lib\CORE
$(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
.ENDIF
$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
- $(XCOPY) $(GLOBBAT) $(INST_BIN)\*.*
$(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
- $(XCOPY) bin\*.* $(INST_BIN)\*.*
+ $(XCOPY) bin\*.bat $(INST_BIN)\*.*
$(RCOPY) ..\lib $(INST_LIB)\*.*
$(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
$(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
-@erase $(CORE_OBJ)
-@erase $(WIN32_OBJ)
-@erase $(DLL_OBJ)
- -@erase ..\*.obj *.obj ..\*.lib ..\*.exp
+ -@erase ..\*.obj ..\*.lib ..\*.exp *.obj *.lib *.exp
+ -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
-@erase *.ilk
-@erase *.pdb