summaryrefslogtreecommitdiff
path: root/lib/Pod/Usage.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Pod/Usage.pm')
-rw-r--r--lib/Pod/Usage.pm31
1 files changed, 23 insertions, 8 deletions
diff --git a/lib/Pod/Usage.pm b/lib/Pod/Usage.pm
index 571588ebd2..388607617d 100644
--- a/lib/Pod/Usage.pm
+++ b/lib/Pod/Usage.pm
@@ -10,7 +10,7 @@
package Pod::Usage;
use vars qw($VERSION);
-$VERSION = 1.12; ## Current version of this package
+$VERSION = 1.14; ## Current version of this package
require 5.005; ## requires this Perl version or later
=head1 NAME
@@ -46,7 +46,7 @@ B<pod2usage> should be given either a single argument, or a list of
arguments corresponding to an associative array (a "hash"). When a single
argument is given, it should correspond to exactly one of the following:
-=over
+=over 4
=item *
@@ -68,7 +68,7 @@ assumed to be a hash. If a hash is supplied (either as a reference or
as a list) it should contain one or more elements with the following
keys:
-=over
+=over 4
=item C<-message>
@@ -80,6 +80,9 @@ program's usage message.
=item C<-exitval>
The desired exit status to pass to the B<exit()> 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>
@@ -129,7 +132,7 @@ Unless they are explicitly specified, the default values for the exit
status, verbose level, and output stream to use are determined as
follows:
-=over
+=over 4
=item *
@@ -159,7 +162,7 @@ Although the above may seem a bit confusing at first, it generally does
"the right thing" in most situations. This determination of the default
values to use is based upon the following typical Unix conventions:
-=over
+=over 4
=item *
@@ -211,7 +214,7 @@ convenient to use as an innocent looking error message handling function:
## Check for too many filenames
pod2usage("$0: Too many files given.\n") if (@ARGV > 1);
-Some users however may feel that the above "economy of expression" is
+Some user's however may feel that the above "economy of expression" is
not particularly readable nor consistent and may instead choose to do
something more like the following:
@@ -395,6 +398,7 @@ with re-writing this manpage.
use strict;
#use diagnostics;
use Carp;
+use Config;
use Exporter;
use File::Spec;
@@ -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');
}
##---------------------------------------------------------------------------