Permalink
Browse files

Recognize .bat Perl scripts.

  • Loading branch information...
1 parent c3ab998 commit 4605268b5c853aa2667c808d0c1a9aa54c8ae3ac @theory theory committed Mar 10, 2010
Showing with 43 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +3 −0 Changes
  3. +1 −1 lib/Test/Pod.pm
  4. +2 −0 t/all_pod_files.t
  5. +35 −0 t/pod/good-pod-script.bat
View
@@ -5,3 +5,5 @@ MANIFEST.bak
META.*
MYMETA.*
Build
+*.rej
+*.orig
View
@@ -10,6 +10,9 @@ Change log for Test::Pod
`configure_requires`.
* Updated `MANIFEST` so that the `README` is actually included in the
distribution.
+ * Now recognizes `.bat` files as Perl files when they contain
+ "--*-Perl-*--" on the first line. Thanks to Olivier 'dolmen' Mengué for
+ the patch (RT #46973).
1.41 - 2010-01-14T20:09:25
* Maintenance transfered to David Wheeler.
View
@@ -253,7 +253,7 @@ sub _is_perl {
my $first = <$fh>;
close $fh;
- return 1 if defined $first && ($first =~ /^#!.*perl/);
+ return 1 if defined $first && ($first =~ /(?:^#!.*perl)|--\*-Perl-\*--/);
return;
}
View
@@ -13,6 +13,7 @@ if ( $^O eq "VMS" ) {
@expected = (
File::Spec->catfile( 'blib', 'lib', 'Test', 'Pod.pm' ),
File::Spec->catfile( 't', 'pod', 'good-pod-script.' ),
+ File::Spec->catfile( 't', 'pod', 'good-pod-script.bat' ),
File::Spec->catfile( 't', 'pod', 'good.pod' ),
File::Spec->catfile( 't', 'pod', 'no_pod.pod' ),
);
@@ -23,6 +24,7 @@ else {
@expected = qw(
blib/lib/Test/Pod.pm
t/pod/good-pod-script
+ t/pod/good-pod-script.bat
t/pod/good.pod
t/pod/no_pod.pod
);
View
@@ -0,0 +1,35 @@
+@rem = '--*-Perl-*--
+@echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+@rem ';
+#!/usr/bin/perl
+#line 15
+
+=head1 NAME
+
+This is a pretend script that we need to check
+
+=head1 DESCRIPTION
+
+This is a pod file without errors.
+
+=head1 AUTHOR
+
+Andy Lester, garbage-address@aol.com
+
+=head1 COPYRIGHT
+
+Copyright 2004, Andy Lester
+
+=cut
+
+__END__
+:endofperl

0 comments on commit 4605268

Please sign in to comment.