Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: How to find what options are used for Getopt::Long

by doubledecker (Scribe)
on Aug 03, 2012 at 09:37 UTC ( #985203=note: print w/replies, xml ) Need Help??


in reply to Re: How to find what options are used for Getopt::Long
in thread How to find what options are used for Getopt::Long

here is my code

#!/usr/bin/perl use strict; use Getopt::Long; $Getopt::Long::autoabbrev = 1; $Getopt::Long::ignorecase = 0; my ($opt_help, $opt_cfg, $opt_verbose, $opt_silent, $opt_dir); GetOptions( "help" => \$opt_help, "cfg=s" => \$opt_cfg, "verbose" => \$opt_verbose, "silent" => \$opt_silent, "dir=s" => \$opt_dir, ) or die "Mandatory options not supplied\n"; # How to find out which option is passed via Getopt. # I can rely on the variables for their definedness, but options might + increase and # considerably. Is there any short way that I can find where all the o +ptions are stored # say in a hash.

Replies are listed 'Best First'.
Re^3: How to find what options are used for Getopt::Long
by Anonymous Monk on Aug 03, 2012 at 09:49 UTC
    #!/usr/bin/perl -- my @argv = @ARGV; ... your code here ... use Data::Dump; dd { before => \@argv, after => \@ARGV };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985203]
help
Chatterbox?
[Eily]: someday FF will start posting back messages where you tell to ignore the previous message
[Eily]: and Hilarity Ensues
Eily says, while failing to write a link properly
[Your Mother]: Goodbye Fancy Feast! Hello Friskies!!!
[LanX]: CB sidebar auto-expansion problem
[Eily]: "tail: warning: following standard input indefinitely is ineffective". I can't help but feel that tail is judging me...
[Your Mother]: Someone had to say it. Better it came from tail.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-03-27 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.