Getopt::Std::Strict
use Getopt::Std::Strict 'abc:', 'opt'; $opt_a; $opt_b; $opt_c; $OPT{a}; $OPT{b}; $OPT{c}; opt(a); opt(b); opt(c); opt(f); # dies, there's no opt f. # To change the values.. $opt_a = 1; opt( a => 1 ); opt( 'a', 1 ); $OPT{a} = 1;
Getopt::Std is nice but it could be even easier to use. This is how I would like Getopt::Std to behave.
Two main concepts are strengthened here, on top of Getopt::Std.
1) Variables are created even under use strict 2) Your option specs are passed at compile time.
The first import string to use is what you would send to Getopt::Std. If you have an option flag 'g' and a paramater 'r' taking an argument, the usage would be..
use strict; use Getopt::Std::Strict 'gr:'; $opt_g;
This makes available throughout your program the variables $opt_g and $opt_r, as well as the hash %OPT, which contains $OPT{g} and $OPT{r}.
Compare that with the alternative..
use strict; use Getopt::Std; my %o; getopts('gr:', \%o); $o->{g};
In development. But works great.
Send any bugs or feature requests to AUTHOR.
Getopt::Std
Leo Charre leocharre at cpan dot org
To install Getopt::Std::Strict, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Getopt::Std::Strict
CPAN shell
perl -MCPAN -e shell install Getopt::Std::Strict
For more information on module installation, please visit the detailed CPAN module installation guide.