X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPod%2FUsage.pm;h=771cff451cb2c324e2515682ac0eaf3fd112aa61;hb=bbed45f69afd2733a47fb6f98dde2d952fd14e1e;hp=56e91fc7d749fb818a891b6cfa72b10cee9cb073;hpb=92e3d63aacb66085fea74c3f951f09e136337b97;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm index 56e91fc..771cff4 100644 --- a/lib/Pod/Usage.pm +++ b/lib/Pod/Usage.pm @@ -10,7 +10,7 @@ package Pod::Usage; use vars qw($VERSION); -$VERSION = 1.13; ## Current version of this package +$VERSION = 1.14; ## Current version of this package require 5.005; ## requires this Perl version or later =head1 NAME @@ -80,6 +80,9 @@ program's usage message. =item C<-exitval> The desired exit status to pass to the B function. +This should be an integer, or else the string "NOEXIT" to +indicate that control should simply be returned without +terminating the invoking process. =item C<-verbose> @@ -395,6 +398,7 @@ with re-writing this manpage. use strict; #use diagnostics; use Carp; +use Config; use Exporter; use File::Spec; @@ -474,7 +478,7 @@ sub pod2usage { unless ((ref $opts{"-input"}) || (-e $opts{"-input"})) { my ($dirname, $basename) = ('', $opts{"-input"}); my $pathsep = ($^O =~ /^(?:dos|os2|MSWin32)$/) ? ";" - : (($^O eq 'MacOS') ? ',' : ":"); + : (($^O eq 'MacOS' || $^O eq 'VMS') ? ',' : ":"); my $pathspec = $opts{"-pathlist"} || $ENV{PATH} || $ENV{PERL5LIB}; my @paths = (ref $pathspec) ? @$pathspec : split($pathsep, $pathspec); @@ -497,8 +501,19 @@ sub pod2usage { } ## Now translate the pod document and then exit with the desired status - $parser->parse_from_file($opts{"-input"}, $opts{"-output"}); - exit($opts{"-exitval"}); + if ( $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{bin}, "perldoc"); + system($progpath, $opts{"-input"}); + } + else { + $parser->parse_from_file($opts{"-input"}, $opts{"-output"}); + } + + exit($opts{"-exitval"}) unless (lc($opts{"-exitval"}) eq 'noexit'); } ##--------------------------------------------------------------------------- @@ -542,3 +557,4 @@ sub preprocess_paragraph { return $self->SUPER::preprocess_paragraph($_); } +1; # keep require happy