Hi everybody!

I'm going to be documenting a system of (30+) programs with is mostly scripts, 
rather than modules.  I know you can just put pod text in your scripts, but 
I'd like to also integrate the usage messages into the pods (or get them from 
the pods.)

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.

Example:

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

Since the strings printed by usage() in this case are generated on the fly, 
the values which have already been set are available to be printed.  With 
pod2usage() and perldoc, this is not the case.  Is there any way to make this 
work without having to maintain duplicate information?

Preferably, something that would try to do() the file up to a certain point, 
gather the variables and perform a substitution (maybe on a tag like 
v<$rounding>.)

Thanks,
Eric
-- 
"There are three terrible ages of childhood -- 1 to 10, 10 to 20, 
and 20 to 30."
                                        --Cleveland Amory

Reply via email to