use Getopt::Long; %opt_ctl = ( "recipient_of_message|r=s@", \@recips, # "URLs_to_use|u=s@", \@urls_in, "do_all_VIPs_except_those_expected_down|a!", \$all, "do_all_VIPs_without_excepotions|awe!", \$awe, "timeout_for_gets|t=i", \$timeout, "show_usage|h!", \$sho_usag +e, "debug|d=i", \$debug, "select_this_proxy_-_1_or_3_or_user_specified|p=s", \$proxy_sel, "smtp_server|s=s", \$smtpsrvr, "time_between_cycles|w=i", \$wait, "no_mail_sent_ever|nm!", \$no_mail, "no_proxy|np!", \$no_proxy, ); Getopt::Long::Configure( qw(no_auto_abbrev) ); $debug = 0; if ( not GetOptions(%opt_ctl) or $sho_usage ) { usage() } sub usage { (@f, %switch, $out, ) = ( ); # $out = "\nUsage:\n\n$0 [ -t timeout ] [ -p 1 | -p 3 | -p proxy_U +RL] [ -e ] [ -a ] [ -d ] [ -w wait ]\n"; #self-document switch options for ( keys %opt_ctl ) { @f = split(/\||=|!/); $switch{$f[1]} = $f[0]; } for ( sort keys %switch ) { $def = $switch{$_}; $def =~ s/\_/ /g; $_ = '-' . $_; $out .= sprintf "%4s: %s\n", $_, $def; } print "$out\n"; exit; }
In reply to "self documenting" switch options by bobn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |