Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: deriving usage from Getopts::Long

by jimbojones (Friar)
on Jul 29, 2005 at 12:40 UTC ( #479388=note: print w/ replies, xml ) Need Help??


in reply to deriving usage from Getopts::Long

Hi,

Check out The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan! on how to use Getopt::Long with Pod::Usage. This should will cover the case of the POD (the user doc) matching the the usage sub, as the text will be derived from the same point, the POD.

The one thing it won't cover is the comments:
our $debug = 0; # switch on debuging our $verbose = 0; # important info to STDOUT my $help = 0; # show usage my $force = 0; # run even if less than 5 since last run
....

However, as has been discussed in multiple places in the Monastery, the choice of variable names (self-commenting) is much more important than the comments after the variable declarations. All of your variable names seem to be self-documenting, so I'm not sure it's necessary to have such detailed comments after their declarations. I would maintain that having POD, usage and self-documenting variables is the way to go here.

- j


Comment on Re: deriving usage from Getopts::Long
Download Code
Re^2: deriving usage from Getopts::Long
by bluto (Curate) on Jul 29, 2005 at 17:51 UTC
    I second using Getopt::Long with Pod::Usage when possible. It works well in practice, and I don't have to lug around extra README files or man pages.

    For scripts that I've written without Pod::Usage, I like putting my own usage() function at the top of the script. That way I can see it up front as a reference (and make it easier to remember I need to keep it up to date).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://479388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2014-07-24 11:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls