develooper Front page | perl.perl5.porters | Postings from April 2003

Re: [PATCH 5.8.1 @19053] Getopt::Std

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
April 2, 2003 00:03
Subject:
Re: [PATCH 5.8.1 @19053] Getopt::Std
Message ID:
20030402100400.0018ebe1.rgarciasuarez@free.fr
Ilya Zakharevich wrote:
> This patch updates getopts() to the world of today.

I like the idea. I'll manage to apply it. A few preliminary remarks :

> --- ./lib/Getopt/Std.pm-pre	Fri Jul 19 16:49:48 2002
> +++ ./lib/Getopt/Std.pm	Tue Apr  1 15:54:48 2003
[...]
> +In presence of these arguments getopts() calls
> +C<exit($GetOpt::Std::EXIT_ON_HELP_VERSION)> if
> +$GetOpt::Std::EXIT_ON_HELP_VERSION is defined.

s/GetOpt/Getopt/g in the docs

> +One can print the messages of C<--help> and C<--version> by calling functions
> +help_mess() and version_mess() with the switches string as an argument.
> +
>  =cut
>  
>  @ISA = qw(Exporter);
>  @EXPORT = qw(getopt getopts);
> -$VERSION = '1.03';
> +$VERSION = '1.04';
>  
>  # Process single-character switches with switch clustering.  Pass one argument
>  # which is a string containing all switches that take an argument.  For each
> @@ -112,19 +127,57 @@ sub getopt (;$$) {
>      }
>  }
>  
> +sub version_mess ($;$) {

I don't understand what the 2nd argument is for ? it's not used.
Do you have further plans about it ? (same remark for help_mess)

> +    my $args = shift;
> +    if (@ARGV and defined &main::VERSION_MESSAGE) {
> +	main::VERSION_MESSAGE($args, $VERSION);
> +    } else {
> +	my $v = $main::VERSION;
> +	$v = '[unknown]' unless defined $v;
> +	print <<EOH;
> +$0 version $v calling Getopt::Std::getopts (version $VERSION),
> +running under Perl version $].

I'd replace $] by some modern-looking and non-backportable sprintf("%vd",$^V).

-- 
Uncanny is not *NIX

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About