Leo Charre > Getopt-Std-Strict-1.01 > Getopt::Std::Strict

Download:
Getopt-Std-Strict-1.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.01   Source  

NAME ^

Getopt::Std::Strict

SYNOPSIS ^

   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;

DESCRIPTION ^

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};

SUBS ^

opt()

CAVEATS ^

In development. But works great.

BUGS ^

Send any bugs or feature requests to AUTHOR.

SEE ALSO ^

Getopt::Std

AUTHOR ^

Leo Charre leocharre at cpan dot org

syntax highlighting: