Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Pod CPAN distribution.

Report information
The Basics
Id: 46973
Status: resolved
Priority: 0/
Queue: Test-Pod

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.26
Fixed in: 1.42



Subject: all_pod_files_ok() doesn't recognize .bat files created by pl2bat as perl
On Win32, the _is_perl function does not match .bat files which are perl programs converted to .bat with pl2bat. So scripts are not checked on Win32. _is_perl only checks that the first line of a file with an unknown extension matches /^#!.*perl/. It should also check for '--*-Perl-*--'.
Subject: [PATCH] all_pod_files_ok() doesn't recognize .bat files created by pl2bat as perl
Here is a patch, including the updated test suite. I'm also attaching a distropref for those who would apply the patch immediately.
--- comment: "RT46973 all_pod_files_ok() doesn't recognize .bat files created by pl2bat as perl" match: distribution: "^PETDANCE/Test-Pod-1.26.tar.gz$" patches: - "DOLMEN/patches/Test-Pod-1.26-PETDANCE-RT46973.patch"
# RT46973 all_pod_files_ok() doesn't recognize .bat files created by pl2bat as perl # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # If you have a decent Bourne-type shell: # STEP 2: Run the shell with this file as input. # If you don't have such a shell, you may need to manually create/delete # the files as shown below. # STEP 3: Run the 'patch' program with this file as input. # # These are the commands needed to create/delete files/directories: # rm -f "t/pod/good-pod-script" touch "t/pod/good-pod-script.bat" chmod 0777 "t/pod/good-pod-script.bat" # # This command terminates the shell and need not be executed manually. exit # #### End of Preamble #### #### Patch data follows #### diff -urp --binary "Test-Pod-1.26\MANIFEST" "Test-Pod-1.26.RT46973\MANIFEST" Index: ./MANIFEST --- ./MANIFEST Wed Jul 19 16:58:50 2006 +++ ./MANIFEST Tue Jun 16 00:47:01 2009 @@ -15,7 +15,7 @@ t/load.t t/missing-file.t t/pod.t t/pod/good-pod-script -t/pod/good-pod-script +t/pod/good-pod-script.bat t/pod/good.pod t/pod/no_pod.pod t/selftest.t diff -urp --binary "Test-Pod-1.26\Pod.pm" "Test-Pod-1.26.RT46973\Pod.pm" Index: ./Pod.pm --- ./Pod.pm Wed Jul 19 16:55:01 2006 +++ ./Pod.pm Tue Jun 16 00:49:31 2009 @@ -231,7 +231,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; } diff -urp --binary "Test-Pod-1.26\t\all_pod_files.t" "Test-Pod-1.26.RT46973\t\all_pod_files.t" Index: ./t/all_pod_files.t --- ./t/all_pod_files.t Wed Jul 19 16:45:46 2006 +++ ./t/all_pod_files.t Tue Jun 16 00:46:14 2009 @@ -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 ); diff -urp --binary nul "Test-Pod-1.26.RT46973\t\pod\good-pod-script.bat" Index: ./t/pod/good-pod-script.bat --- ./t/pod/good-pod-script.bat Thu Jan 1 01:00:00 1970 +++ ./t/pod/good-pod-script.bat Tue Jun 16 00:42:18 2009 @@ -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 #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Tue Jun 16 00:50:22 2009 # Generated by : makepatch 2.03 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # r "t/pod/good-pod-script" 240 0 # p "MANIFEST" 471 1245106021 0100666 # p "Pod.pm" 6391 1245106171 0100666 # p "t/all_pod_files.t" 843 1245105974 0100666 # c "t/pod/good-pod-script.bat" 0 1245105738 0100777 #### End of ApplyPatch data #### #### End of Patch kit [created: Tue Jun 16 00:50:22 2009] #### #### Patch checksum: 124 3911 64700 #### #### Checksum: 155 5062 31229 ####
Thanks, patch applied: http://github.com/theory/test-pod/commit/4605268b5c853aa2667c808d0c1a9aa54c8ae3ac New version today. Best, David