Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: GetOpt::Long empty ARGV

by VinsWorldcom (Prior)
on Jan 11, 2016 at 15:59 UTC ( [id://1152490]=note: print w/replies, xml ) Need Help??


in reply to GetOpt::Long empty ARGV

This is the template I use:

use strict; use warnings; use Getopt::Long qw(:config no_ignore_case); use Pod::Usage; my %opt; my ( $opt_help, $opt_man ); GetOptions( # 'add+' => \$opt{add}, # 'flag!' => \$opt{flag}, # 'integer=i' => \$opt{integer}, # 'optional:s' => \$opt{optional}, # 'string=s' => \$opt{string}, 'help!' => \$opt_help, 'man!' => \$opt_man, ) or pod2usage( -verbose => 0 ); pod2usage( -verbose => 1 ) if defined $opt_help; pod2usage( -verbose => 2 ) if defined $opt_man; # Make sure at least one argument provided if ( !@ARGV ) { pod2usage( -verbose => 0, -message => "$0: one argument required\n +" ); } __END__ =head1 NAME [TITLE] - [TEXT] =head1 SYNOPSIS [PROGNAME ARGS] =head1 DESCRIPTION [TEXT DESCRIPTION] =head1 OPTIONS [OPT DESCRIPTION] --help Print Options and Arguments. --man Print complete man page. =head1 LICENSE This software is released under the same terms as Perl itself. If you don't know what that means visit L<http://perl.com/>. =cut

Replies are listed 'Best First'.
Re^2: GetOpt::Long empty ARGV
by Pazitiff (Novice) on Jan 12, 2016 at 04:04 UTC
    Thanks guys. You helped me a lot!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-24 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found