Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Feedback on my second script

by karlgoethebier (Curate)
on May 15, 2013 at 13:00 UTC ( #1033678=note: print w/ replies, xml ) Need Help??


in reply to Feedback on my second script

BTW, if using Getopt::Long why not also Pod::Usage?

Built-in documentation, e.g../acme.pl --help or perldoc acmel.pl. Easy to use and very handy (I'm reseller ;-)).

#!/usr/bin/perl use warnings; use strict; use Getopt::Long; use Pod::Usage; my %options; Getopt::Long::Configure("no_ignore_case"); GetOptions(\%options, "help", "foo=s","bar=s",); pod2usage( -exitstatus => 0, -verbose => 2 ) if $options{help}; foreach my $option (%options ) { pod2usage( -exitstatus => 2, -verbose => 1 ) unless $option; } # ...the rest. __END__ =pod =head1 NAME acme.pl =head1 SYNOPSIS Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonu +my eirmod tempor invidunt ut labore et dolore magna aliquyam erat, se +d diam voluptua. acme.pl [options] =head1 OPTIONS =over 8 =item B<-h --help> Print a brief help message and exit. =item B<-f, --foo> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse m +olestie consequat, vel illum dolore eu feugiat nulla facilisis. Manda +tory. =item B<-b, --bar> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper s +uscipit lobortis nisl ut aliquip ex ea commodo consequat. Mandatory. =back =head1 DESCRIPTION At vero eos et accusam et justo duo dolores et ea rebum. Stet clita ka +sd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam no +numy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, +sed diam voluptua. At vero eos et accusam et justo duo dolores et ea +rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem i +psum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscin +g elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore m +agna aliquyam erat, sed diam voluptua. At vero eos et accusam et just +o duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata + sanctus est Lorem ipsum dolor sit amet. =head1 EXAMPLE ./acme.pl --foo nose --bar cuke =head1 BUGS None. =head1 AUTHOR Karl Goethebier <karl.goethebier@snakeoil.com> =head1 COPYRIGHT (C) 2013 Snakeoil Ltd. =cut

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»


Comment on Re: Feedback on my second script
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2014-09-20 15:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls