Getopt::WonderBraLift and Separate Command Line Options | |
Download |
Getopt::WonderBra Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Rich Paul
- Publisher web site:
- http://search.cpan.org/~rpaul/
Getopt::WonderBra Tags
Getopt::WonderBra Description
Lift and Separate Command Line Options Getopt::WonderBra is a Perl module to lift and separate command-line options.Developer commentsThere just weren't enough command line processessing modules, so I had to write my own. Actually, it exists because it made it easy to port shell scripts to perl: it acts just like the getopt program. Oddly, none of the modules that are actually named after it do. (Though some act like the C function) The following sequence chops your args up and gives 'em to you straight:SYNOPSIS use Getopt::WonderBra; @ARGV = getopt( 'opts:-:', @ARGV ); sub help() { print "Useless help message"; }; sub version() { print "Useless version message"; }; while ( ( $_ = shift ) ne '--' ) { if (/^-o$/) { $opt_o++ } elsif (/^-p$/) { $opt_p++ } elsif (/^-t$/) { $opt_t++ } elsif (/^-s$/) { push( @opt_s, shift ); } elsif (/^--/) { push( @opt_long, $_ ); } else { die 'I do not grok -', $_; } } print "-o given $opt_o times" if $opt_o; print "-p given $opt_p times" if $opt_p; print "-t given $opt_t times" if $opt_t; print "-s given with arg $_" for @opt_s; print "long opt $_ given" for @opt_long; print ""; print " param: $_" for @ARGV; Requirements: · Perl · Carp · Exporter
Getopt::WonderBra Related Software