Skip Menu |

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

Report information
The Basics
Id: 75598
Status: resolved
Priority: 0/
Queue: Pod-Parser

People
Owner: Marek.Rouchal [...] gmx.net
Requestors: shay [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.51
Fixed in: (no value)



Subject: [PATCH] Don't use perldoc if is is missing
I have a CPAN distribution (Filter-Crypto) containing a script with a "-m" option for printing out its manpage using pod2usage(-exitval => 1, -verbose => 2). Generally the test passes, but one or two CPAN Testers keep getting failures, with no output generated instead of the expected manpage. I have added some diag()nostics to the failing test to see if perldoc is present or not, and I've found that it is missing on all systems where the test fails. You can see a typical failure report here: http://www.cpantesters.org/cpan/report/cb88d8ce-6705-11e1-b06a-e122c37f204a (Note that the scriptdir and scriptdirexp locations are both the same, so even the recent fix for CPAN#57954 won't fix it.) I have no idea why these systems have no perldoc on them (despite, as the list of prerequisites in the CPAN Testers reports show, having Pod::Usage installed), but I propose the attached patch to Pod::Usage as a solution. It tests to see if perldoc exists and sets the '-noperldoc' option if it does not, causing the manpage to be printed by the other means on those systems with no perldoc.
Subject: perldoc.patch
diff -ruN Pod-Parser-1.51.orig\lib\Pod\Usage.pm Pod-Parser-1.51\lib\Pod\Usage.pm --- Pod-Parser-1.51.orig\lib\Pod\Usage.pm Wed Jan 25 06:19:04 2012 +++ Pod-Parser-1.51\lib\Pod\Usage.pm Wed Mar 07 08:44:15 2012 @@ -567,6 +567,11 @@ $opts{'-verbose'} = 1; } + ## Check for perldoc + my $progpath = File::Spec->catfile($Config{scriptdirexp} + || $Config{scriptdir}, 'perldoc'); + $opts{'-noperldoc'} = 1 unless -e $progpath; + ## Now translate the pod document and then exit with the desired status if ( !$opts{'-noperldoc'} and $opts{'-verbose'} >= 2 @@ -574,8 +579,6 @@ and $opts{'-output'} == \*STDOUT ) { ## spit out the entire PODs. Might as well invoke perldoc - my $progpath = File::Spec->catfile($Config{scriptdirexp} - || $Config{scriptdir}, 'perldoc'); print { $opts{'-output'} } ($opts{'-message'}, "\n") if($opts{'-message'}); if(defined $opts{-input} && $opts{-input} =~ /^\s*(\S.*?)\s*$/) { # the perldocs back to 5.005 should all have -F
On Wed Mar 07 03:56:05 2012, SHAY wrote: Show quoted text
> I have no idea why these systems have no perldoc on them (despite, as > the list of prerequisites in the CPAN Testers reports show, having > Pod::Usage installed), but I propose the attached patch to Pod::Usage as > a solution. > > It tests to see if perldoc exists and sets the '-noperldoc' option if it > does not, causing the manpage to be printed by the other means on those > systems with no perldoc.
An update on this: After speaking with Chris 'BinGOs' Williams, several of whose smokers were reporting this error, I have learned that the systems in question *do* have perldoc on them, but it has a name like "perldoc5.15.7" due to the Configure option "versiononly" being set. Chris suggests using code something like the following to locate perldoc: my $perldoc = 'perldoc'; my $version = sprintf("%vd",$^V); if ($Config::Config{versiononly} and $Config::Config{startperl} =~ /\Q$version\E$/ ) { $perldoc .= $version; } See the _scripts() function in the CPANPLUS Makefile.PL. See also the way in which Pod::Perldoc defines $Pod2man to locate the similarly-affected pod2man script. I would therefore like to see Pod::Usage enhanced along these lines, and I think it would also still be useful to incorporate my original suggestion of falling back on other means if perldoc is *still* missing even after taking the above into account.
Integrated as suggested in Pod-Usage-1.60, to be released soon.