X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FGetopt%2FStd.pm;h=823bc4dd910ecf3964f57f95e5867472ad738f6f;hb=e63b33793c3cf76a134a6446d1f83479e030a15f;hp=99e9269676ffa23a04dc16c80a9cec02230f6ad1;hpb=294d099eb0fb837b82ab70fe7f81a0b70a4fa5c9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Getopt/Std.pm b/lib/Getopt/Std.pm index 99e9269..823bc4d 100644 --- a/lib/Getopt/Std.pm +++ b/lib/Getopt/Std.pm @@ -4,9 +4,7 @@ require Exporter; =head1 NAME -getopt - Process single-character switches with switch clustering - -getopts - Process single-character switches with switch clustering +getopt, getopts - Process single-character switches with switch clustering =head1 SYNOPSIS @@ -30,6 +28,7 @@ there is a space between the switch and the argument. The getopts() function is similar, but you should pass to it the list of all switches to be recognized. If unspecified switches are found on the command-line, the user will be warned that an unknown option was given. +The getopts() function returns true unless an invalid option was found. Note that, if your code is running under the recommended C pragma, you will need to declare these package variables @@ -55,6 +54,9 @@ the output file handle, the name of option-processing package, its version, and the switches string. If the subroutines are not defined, an attempt is made to generate intelligent messages; for best results, define $main::VERSION. +If embedded documentation (in pod format, see L) is detected +in the script, C<--help> will also show how to access the documentation. + Note that due to excessive paranoia, if $Getopt::Std::STANDARD_HELP_VERSION isn't true (the default is false), then the messages are printed on STDERR, and the processing continues after the messages are printed. This being @@ -70,7 +72,7 @@ and version_mess() with the switches string as an argument. @ISA = qw(Exporter); @EXPORT = qw(getopt getopts); -$VERSION = '1.04'; +$VERSION = '1.06'; # uncomment the next line to disable 1.03-backward compatibility paranoia # $STANDARD_HELP_VERSION = 1; @@ -186,12 +188,27 @@ sub help_mess ($;$) { } my ($scr) = ($0 =~ m,([^/\\]+)$,); print $h <) { + $has_pod = 1, last if /^=(pod|head1)/; + } + } + print $h <