Class-Usul
view release on metacpan or search on metacpan
lib/Class/Usul/Options.pm view on Meta::CPAN
use Class::Usul::Options 'usage_conf' => {
highlight => 'none', option_type => 'none', tabstop => 8 };
=head1 Description
This is an extended clone of L<MooX::Options> but is closer to
L<MooseX::Getopt::Dashes>
=head1 Configuration and Environment
The C<option> function accepts the following attributes in addition to those
already supported by C<has>
=over 3
=item C<autosplit>
If set split the option value using this string. Automatically creates a list
of values
=item C<config>
A hash reference passed as the third element in the
list of tuples which forms the second argument to the
L<describe options|Getopt::Long::Descriptive/describe_options> function
For example;
option 'my_attr' => is => 'ro', isa => 'Str', config => { hidden => 1 },
documentation => 'This appears in the option usage output',
format => 's', short => 'a';
would prevent the option from appearing in the usage text
=item C<doc>
Alias for C<documentation>. Used to describe the attribute in the usage output
=item C<format>
Format of the parameters, same as L<Getopt::Long::Descriptive>
i : integer
i@: array of integer
s : string
s@: array of string
s%: hash of string
f : float value
By default, it's a boolean value.
=item C<json>
Boolean which if true means that the argument to the option is in JSON format
and will be decoded as such
=item C<negateable>
Applies only to boolean types. Means you can use C<--nooption-name> to
explicitly indicate false
=item C<order>
Specifies the order in which usage options appear. Attributes with no C<order>
value are alpha sorted
=item C<repeatable>
Boolean which if true means that the option can appear multiple times on the
command line
=item C<short>
A single character that can be used as a short option, e.g. C<-s> instead
of the longer C<--long-option>
=back
Defines no attributes
=head1 Subroutines/Methods
=head2 C<default_options_config>
Returns a list of keys and values. These are the defaults for the configuration
options listed in L</import>
=head2 C<import>
Injects the C<option> function into the caller
Accepts the following configuration options;
=over 3
=item C<getopf_conf>
An array reference of options passed to L<Getopt::Long::Configure>, defaults to
an empty list
=item C<prefer_commandline>
A boolean which defaults to true. Prefer the command line values
=item C<protect_argv>
A boolean which defaults to true. Localises the C<@ARGV> variable before any
processing takes place. Means that C<@ARGV> will contain all of the passed
command line arguments
=item C<show_defaults>
A boolean which defaults to false. If true the default values are added to
use options usage text output
( run in 0.566 second using v1.01-cache-2.11-cpan-39bf76dae61 )