Skip to content

Commit

Permalink
Recognize .bat Perl scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Mar 10, 2010
1 parent c3ab998 commit 4605268
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,5 @@ MANIFEST.bak
META.* META.*
MYMETA.* MYMETA.*
Build Build
*.rej
*.orig
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -10,6 +10,9 @@ Change log for Test::Pod
`configure_requires`. `configure_requires`.
* Updated `MANIFEST` so that the `README` is actually included in the * Updated `MANIFEST` so that the `README` is actually included in the
distribution. 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 1.41 - 2010-01-14T20:09:25
* Maintenance transfered to David Wheeler. * Maintenance transfered to David Wheeler.
Expand Down
2 changes: 1 addition & 1 deletion lib/Test/Pod.pm
Expand Up @@ -253,7 +253,7 @@ sub _is_perl {
my $first = <$fh>; my $first = <$fh>;
close $fh; close $fh;


return 1 if defined $first && ($first =~ /^#!.*perl/); return 1 if defined $first && ($first =~ /(?:^#!.*perl)|--\*-Perl-\*--/);


return; return;
} }
Expand Down
2 changes: 2 additions & 0 deletions t/all_pod_files.t
Expand Up @@ -13,6 +13,7 @@ if ( $^O eq "VMS" ) {
@expected = ( @expected = (
File::Spec->catfile( 'blib', 'lib', 'Test', 'Pod.pm' ), File::Spec->catfile( 'blib', 'lib', 'Test', 'Pod.pm' ),
File::Spec->catfile( 't', 'pod', 'good-pod-script.' ), 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', 'good.pod' ),
File::Spec->catfile( 't', 'pod', 'no_pod.pod' ), File::Spec->catfile( 't', 'pod', 'no_pod.pod' ),
); );
Expand All @@ -23,6 +24,7 @@ else {
@expected = qw( @expected = qw(
blib/lib/Test/Pod.pm blib/lib/Test/Pod.pm
t/pod/good-pod-script t/pod/good-pod-script
t/pod/good-pod-script.bat
t/pod/good.pod t/pod/good.pod
t/pod/no_pod.pod t/pod/no_pod.pod
); );
Expand Down
35 changes: 35 additions & 0 deletions t/pod/good-pod-script.bat
@@ -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.