Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!

by klekker (Pilgrim)
on Jan 14, 2007 at 10:20 UTC ( #594626=note: print w/ replies, xml ) Need Help??

in reply to The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!

I dont't understand the comment:

# Check this last to avoid parsing options as Places, # and so don't override $opt_man verbose level my @places = @ARGV; pod2usage(-verbose => 1) && exit unless @places;
I evaluate "--help" and "--man" as "subs", like
GetOptions( "help|?" => sub { pod2usage( -verbose => 1, -exitval => 0 ); }, "man" => sub { pod2usage( -verbose => 2, -exitval => 0 ); }, # ... ) or pod2usage( -verbose => 1, -exitval => 1);

The '-exitval' lets pod2usage exit the programm for you.

The line "or pod2usage( -verbose => 1, -exitval => 1);" is now added to my code; until I read your article I never thought of checking GetOptions(). But it is a good idea! :)

Comment on Re: The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-11-27 22:58 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (734 votes), past polls