diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-07-03 09:56:20 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-07-03 09:56:20 +0100 |
commit | 5b597d1b365fbf7a687e61304bddd619bc3a53dd (patch) | |
tree | 8e7a817aaa8af29c30f55bd71ac1a4f97c9d535a /cpan/Pod-Usage | |
parent | 5f4b5e0fc88f855528b6c2b8cdd8c546db6fb15a (diff) | |
download | perl-5b597d1b365fbf7a687e61304bddd619bc3a53dd.tar.gz |
Update Pod-Usage to CPAN version 1.64
[DELTA]
1.64 (marekr)
- CPAN#93170: Abstract in pod doesn't follow convention
fixed the NAME section
- CPAN#86932: documentation does not work with use strict
rewritten parts of the DESCRIPTION section
- CPAN#86776: "pod2usage -verbose 2 FILE" is broken when perldoc is missing
verified that pod2usage acts decently if perldoc is missing
note: a Perl installation without perldoc is like a haunted house
without ghosts
Diffstat (limited to 'cpan/Pod-Usage')
-rw-r--r-- | cpan/Pod-Usage/lib/Pod/Usage.pm | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/cpan/Pod-Usage/lib/Pod/Usage.pm b/cpan/Pod-Usage/lib/Pod/Usage.pm index f0dd8350f1..bb8e60f05b 100644 --- a/cpan/Pod-Usage/lib/Pod/Usage.pm +++ b/cpan/Pod-Usage/lib/Pod/Usage.pm @@ -11,7 +11,7 @@ package Pod::Usage; use strict; use vars qw($VERSION @ISA @EXPORT); -$VERSION = '1.63'; ## Current version of this package +$VERSION = '1.64'; ## Current version of this package require 5.006; ## requires this Perl version or later #use diagnostics; @@ -360,7 +360,7 @@ __END__ =head1 NAME -Pod::Usage, pod2usage() - print a usage message from embedded pod documentation +Pod::Usage - print a usage message from embedded pod documentation =head1 SYNOPSIS @@ -594,13 +594,15 @@ use them by default if you don't expressly tell it to do otherwise. The ability of B<pod2usage()> to accept a single number or a string makes it convenient to use as an innocent looking error message handling function: + use strict; use Pod::Usage; use Getopt::Long; ## Parse options - GetOptions("help", "man", "flag1") || pod2usage(2); - pod2usage(1) if ($opt_help); - pod2usage(-verbose => 2) if ($opt_man); + my %opt; + GetOptions(\%opt, "help|?", "man", "flag1") || pod2usage(2); + pod2usage(1) if ($opt{help}); + pod2usage(-exitval => 0, -verbose => 2) if ($opt{man}); ## Check for too many filenames pod2usage("$0: Too many files given.\n") if (@ARGV > 1); @@ -609,23 +611,35 @@ 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: - use Pod::Usage; - use Getopt::Long; + use strict; + use Pod::Usage qw(pod2usage); + use Getopt::Long qw(GetOptions); ## Parse options - GetOptions("help", "man", "flag1") || pod2usage(-verbose => 0); - pod2usage(-verbose => 1) if ($opt_help); - pod2usage(-verbose => 2) if ($opt_man); + my %opt; + GetOptions(\%opt, "help|?", "man", "flag1") || + pod2usage(-verbose => 0); + + pod2usage(-verbose => 1) if ($opt{help}); + pod2usage(-verbose => 2) if ($opt{man}); ## Check for too many filenames pod2usage(-verbose => 2, -message => "$0: Too many files given.\n") - if (@ARGV > 1); + if (@ARGV > 1); + As with all things in Perl, I<there's more than one way to do it>, and B<pod2usage()> adheres to this philosophy. If you are interested in seeing a number of different ways to invoke B<pod2usage> (although by no means exhaustive), please refer to L<"EXAMPLES">. +=head2 Scripts + +The Pod::Usage distribution comes with a script pod2usage which offers +a command line interface to the functionality of Pod::Usage. See +L<pod2usage>. + + =head1 EXAMPLES Each of the following invocations of C<pod2usage()> will print just the @@ -709,8 +723,9 @@ provide a means of printing their complete documentation to C<STDOUT> uses B<Pod::Usage> in combination with B<Getopt::Long> to do all of these things: - use Getopt::Long; - use Pod::Usage; + use strict; + use Getopt::Long qw(GetOptions); + use Pod::Usage qw(pod2usage); my $man = 0; my $help = 0; @@ -723,6 +738,7 @@ things: ## If no arguments were given, then allow STDIN to be used only ## if it's not connected to a terminal (otherwise print usage) pod2usage("$0: No files given.") if ((@ARGV == 0) && (-t STDIN)); + __END__ =head1 NAME @@ -739,7 +755,7 @@ things: =head1 OPTIONS - =over 8 + =over 4 =item B<-help> |