MooseX-App
view release on metacpan or search on metacpan
lib/MooseX/App/ParsedArgv.pm view on Meta::CPAN
=head1 NAME
MooseX::App::ParsedArgv - Parses @ARGV
=head1 SYNOPSIS
use MooseX::App::ParsedArgv;
my $argv = MooseX::App::ParsedArgv->instance;
foreach my $option ($argv->available('option')) {
say "Parsed ".$option->key;
}
=head1 DESCRIPTION
This is a helper class that holds all options parsed from @ARGV. It is
implemented as a singleton. Unless you are developing a MooseX::App plugin
you usually do not need to interact with this class.
=head1 METHODS
=head2 new
Create a new MooseX::App::ParsedArgv instance. Needs to be called as soon
as possible.
=head2 instance
Get the current MooseX::App::ParsedArgv instance. If there is no instance
a new one will be created.
=head2 argv
Accessor for the initinal @ARGV.
=head2 hints
ArrayRef of attributes that tells the parser which attributes should be
regarded as flags without values.
=head2 first_argv
Shifts the current first element from @ARGV.
=head2 available
my @options = $self->available($type);
OR
my @options = $self->available();
Returns an array of all parsed options or parameters that have not yet been consumed.
The array elements will be L<MooseX::App::ParsedArgv::Element> objects.
=head2 consume
my $option = $self->consume($type);
OR
my $option = $self->consume();
Returns the first option/parameter of the local @ARGV that has not yet been
consumed as a L<MooseX::App::ParsedArgv::Element> object.
=head2 elements
Returns all parsed options and parameters.
=head2 extra
Returns an array reference of unconsumed positional parameters and
extra values.
=cut
( run in 0.872 second using v1.01-cache-2.11-cpan-63c85eba8c4 )