summaryrefslogtreecommitdiff
path: root/win32/bin/PL2BAT.BAT
diff options
context:
space:
mode:
Diffstat (limited to 'win32/bin/PL2BAT.BAT')
-rw-r--r--win32/bin/PL2BAT.BAT40
1 files changed, 40 insertions, 0 deletions
diff --git a/win32/bin/PL2BAT.BAT b/win32/bin/PL2BAT.BAT
new file mode 100644
index 0000000000..462affa7d0
--- /dev/null
+++ b/win32/bin/PL2BAT.BAT
@@ -0,0 +1,40 @@
+@rem = '
+@echo off
+perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+@rem ';
+
+$head = <<'--end--';
+@rem = '--*-Perl-*--';
+@rem = '
+@echo off
+perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+@rem ';
+--end--
+
+$tail = "__END__\n:endofperl\n";
+
+if ( @ARGV ) {
+ LOOP:
+ foreach ( @ARGV ) {
+ open( FILE, $_ );
+ @file = <FILE>;
+ if ( grep( /:endofperl/, @file ) ) {
+ warn "$_ has already been converted to a batch file!!\n";
+ next LOOP;
+ }
+ close( FILE, $_ );
+ s/\.pl//;
+ s/\.bat//;
+ open( FILE, ">$_.bat" );
+ print FILE $head, @file, $tail;
+ close( FILE );
+ }
+} else {
+ @file = <STDIN>;
+ print $head, @file, $tail;
+}
+
+__END__
+:endofperl