script/pl2bat.pl untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 39 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2  
3 require 5;
4 use ExtUtils::PL2Bat;
5 use Getopt::Std;
6  
7 $0 =~ s|.*[/\\]||;
8  
9 my $usage = <<EOT;
10 Usage: $0 [-h]
11 or: $0 [-w] [-u] [-a argstring] [-s stripsuffix] [files]
12 or: $0 [-w] [-u] [-n ntargs] [-o otherargs] [-s stripsuffix] [files]
13 -n ntargs arguments to invoke perl with in generated file
14 when run from Windows NT. Defaults to
15 '-x -S %0 %*'.
16 -o otherargs arguments to invoke perl with in generated file
17 other than when run from Windows NT. Defaults
18 to '-x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9'.
19 -u update files that may have already been processed
20 by (some version of) pl2bat.
21 -w include "-w" on the /^#!.*perl/ line (unless
22 a /^#!.*perl/ line was already present).
23 -s stripsuffix strip this suffix from file before appending ".bat"
24 Not case-sensitive
25 Can be a regex if it begins with '/'
26 Defaults to "/\.plx?/"
27 -h show this help
28 EOT
29  
30 my %OPT = ();
31 warn($usage), exit(0) if !getopts('whun:o:a:s:',\%OPT) or $OPT{'h'};
32 die '-a option has been removed' if $OPT{a};
33  
34 my %key_for = (
35 n => 'ntargs',
36 o => 'otherargs',
37 a => 'argstring',
38 u => 'update',
39 w => 'usewarnings'
40 );
41  
42 my %args;
43 for my $old_key (keys %key_for) {
44 if (exists $OPT{$old_key}) {
45 $args{$key_for{$old_key}} = $OPT{$old_key};
46 }
47 }
48 if (exists $OPT{s}) {
49 $args{strip_suffix} = $OPT{'s'} =~ m#^/([^/]*[^/\$]|)\$?/?$# ? qr/$1/ : qr/\Q$OPT{'s'}\E/;
50 }
51  
52 for my $file (@ARGV) {
53 pl2bat(%args, in => $file);
54 }
55  
56 __END__