Getopt::LL::Simple


Getopt-LL documentation Contained in the Getopt-LL distribution.

Index


Code Index:

# Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # End: # vim: expandtab tabstop=4 shiftwidth=4 shiftround


Getopt-LL documentation Contained in the Getopt-LL distribution.

# $Id: Simple.pm,v 1.5 2007/07/13 00:00:14 ask Exp $
# $Source: /opt/CVS/Getopt-LL/lib/Getopt/LL/Simple.pm,v $
# $Author: ask $
# $HeadURL$
# $Revision: 1.5 $
# $Date: 2007/07/13 00:00:14 $
package Getopt::LL::Simple;
use strict;
use warnings;
use Getopt::LL::Short qw(getoptions);
use version; our $VERSION = qv('1.0.0');
use 5.006_001;

sub import {
    my ($pkg, @rules) = @_;
    my $caller = caller;

    my $options_ref;
    if (scalar @rules && ref $rules[-1] eq 'HASH') {
        $options_ref = pop @rules;
    }

    my $options
        = getoptions(\@rules, $options_ref);

    no strict 'refs'; ## no critic
    %{ $caller . q{::} . 'ARGV' } = %{ $options };

    return;
}

1;
__END__