* Eric Wilhelm [EMAIL PROTECTED] [2004-06-25 05:11]:
I've seen pod2usage() and this would work, but most of these
scripts have some defaults set for variables that can be
changed with the GetOptions flags and I'd like to show these
defaults at least in the help message.
You are looking for
my $rounding = 0.01;
GetOptions(
'round=f' = \$rounding,
'help' = sub {usage()},
);
sub usage {
print usage: $0 filename\n;
print options: --round float (default $rounding)\n;
}
END
This will have a nasty side effect, as shown below:
$
A. Pagaltzis wrote:
* Eric Wilhelm [EMAIL PROTECTED] [2004-06-25 05:11]:
I've seen pod2usage() and this would work, but most of these
scripts have some defaults set for variables that can be
changed with the GetOptions flags and I'd like to show these
defaults at least in the help message.
# The following was supposedly scribed by
# Johan Vromans
# on Friday 25 June 2004 03:00 am:
This will have a nasty side effect, as shown below:
$ round --round=42 --help
usage: round filename
options: --round float (default 42)
Yes, this is correct. But I was planning something
# The following was supposedly scribed by
# Randy W. Sims
# on Thursday 24 June 2004 10:40 pm:
You'll want
to subclass Pod::Text, override the proper method to add a new escape
sequence (say $variable_name), then maybe override the constructor to
take a hash with the values for the variables or