Subject: | Sometimes -msg ignored with -version >= 2 |
Perl 10.8.8 - Mac OS X 10.5.2 (Intel) - Perl::Usage 1.35
Tried to use perl2usage(...) with a "preceding message", but it wasn't working. Figured out
this happens whenever the "MAN" type output is generated, but it is not clear from the
documentation when this "MAN" output will happen. It only happens SOME of the time when -verbose is set to 2 or more, such as when the output is set to STDERR (see attached file).
I believe the inconsistency is rooted in the following if/then/else block.
## Now translate the pod document and then exit with the desired status
if ( !$opts{"-noperldoc"}
and $opts{"-verbose"} >= 2
and !ref($opts{"-input"})
and $opts{"-output"} == \*STDOUT )
{
## spit out the entire PODs. Might as well invoke perldoc
my $progpath = File::Spec->catfile($Config{scriptdir}, "perldoc");
system($progpath, $opts{"-input"});
if($?) {
# RT16091: fall back to more if perldoc failed
system($ENV{PAGER} || 'more', $opts{"-input"});
}
}
else {
$parser->parse_from_file($opts{"-input"}, $opts{"-output"});
}
This was especially problematic for me to diagnose as I am programming with Eclipse/EPIC,
and the internal run console never generates MAN style pages, only POD formated ones. The
message was sometimes showing up, and sometimes not. However, the inconsistent
behavior descried in the initial paragraphs and in the attached file is not related to the
development environment, but occurs directly in a (bash) shell. Either documentation should
be changed to more clearly reflect the "MAN" vs "POD" formatting issues, or make the
formatting more consistent. Perhaps a setting to print "ALL POD" or "MAN" explicitly?
Note: I checked the CPAN test (pod2usage2.t), but it doesn't cover used the combination of
parameters that output the "MAN" type pages (the first "if" path, in the above code).
Subject: | testPerl2Usage |
Message body not shown because it is not plain text.