Recognize .bat Perl scripts.
David E. Wheeler
14 years ago
4 | 4 |
META.*
|
5 | 5 |
MYMETA.*
|
6 | 6 |
Build
|
|
7 |
*.rej
|
|
8 |
*.orig
|
9 | 9 |
`configure_requires`.
|
10 | 10 |
* Updated `MANIFEST` so that the `README` is actually included in the
|
11 | 11 |
distribution.
|
|
12 |
* Now recognizes `.bat` files as Perl files when they contain
|
|
13 |
"--*-Perl-*--" on the first line. Thanks to Olivier 'dolmen' Mengué for
|
|
14 |
the patch (RT #46973).
|
12 | 15 |
|
13 | 16 |
1.41 - 2010-01-14T20:09:25
|
14 | 17 |
* Maintenance transfered to David Wheeler.
|
252 | 252 |
my $first = <$fh>;
|
253 | 253 |
close $fh;
|
254 | 254 |
|
255 | |
return 1 if defined $first && ($first =~ /^#!.*perl/);
|
|
255 |
return 1 if defined $first && ($first =~ /(?:^#!.*perl)|--\*-Perl-\*--/);
|
256 | 256 |
|
257 | 257 |
return;
|
258 | 258 |
}
|
12 | 12 |
@expected = (
|
13 | 13 |
File::Spec->catfile( 'blib', 'lib', 'Test', 'Pod.pm' ),
|
14 | 14 |
File::Spec->catfile( 't', 'pod', 'good-pod-script.' ),
|
|
15 |
File::Spec->catfile( 't', 'pod', 'good-pod-script.bat' ),
|
15 | 16 |
File::Spec->catfile( 't', 'pod', 'good.pod' ),
|
16 | 17 |
File::Spec->catfile( 't', 'pod', 'no_pod.pod' ),
|
17 | 18 |
);
|
|
22 | 23 |
@expected = qw(
|
23 | 24 |
blib/lib/Test/Pod.pm
|
24 | 25 |
t/pod/good-pod-script
|
|
26 |
t/pod/good-pod-script.bat
|
25 | 27 |
t/pod/good.pod
|
26 | 28 |
t/pod/no_pod.pod
|
27 | 29 |
);
|
|
0 |
@rem = '--*-Perl-*--
|
|
1 |
@echo off
|
|
2 |
if "%OS%" == "Windows_NT" goto WinNT
|
|
3 |
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
|
4 |
goto endofperl
|
|
5 |
:WinNT
|
|
6 |
perl -x -S %0 %*
|
|
7 |
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
|
|
8 |
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
|
|
9 |
if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
|
|
10 |
goto endofperl
|
|
11 |
@rem ';
|
|
12 |
#!/usr/bin/perl
|
|
13 |
#line 15
|
|
14 |
|
|
15 |
=head1 NAME
|
|
16 |
|
|
17 |
This is a pretend script that we need to check
|
|
18 |
|
|
19 |
=head1 DESCRIPTION
|
|
20 |
|
|
21 |
This is a pod file without errors.
|
|
22 |
|
|
23 |
=head1 AUTHOR
|
|
24 |
|
|
25 |
Andy Lester, garbage-address@aol.com
|
|
26 |
|
|
27 |
=head1 COPYRIGHT
|
|
28 |
|
|
29 |
Copyright 2004, Andy Lester
|
|
30 |
|
|
31 |
=cut
|
|
32 |
|
|
33 |
__END__
|
|
34 |
:endofperl
|