App-Base

 view release on metacpan or  search on metacpan

lib/App/Base/Script/Option.pod  view on Meta::CPAN

=encoding utf8

=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated.  Please do not edit
this file, but rather the original, inline with App::Base::Script::Option
at lib/App/Base/Script/Option.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.

=cut

=head1 NAME

App::Base::Script::Option - OO interface for command-line options

=head1 SYNOPSIS

    my $option = App::Base::Script::Option->new(
        {
            name          => 'foo',
            display       => '--foo=<f>',
            documentation => 'Controls the foo behavior of my script.',
            default       => 4,
            option_type   => 'integer',
        }
    );

=head1 DESCRIPTION

App::Base::Script::Option is used by App::Base::Script::Common and its
descendents to implement the standard definition of command-
line options. Typically an object of this class will be
constructed anonymously as part of the anonymous arrayref
return value of the options() method:

    sub options {
        return [
            App::Base::Script::Option->new(
                name          => 'foo',
                documentation => 'The foo option',
                option_type   => 'integer',
            ),
            App::Base::Script::Option->new(
                name          => 'bar',
                documentation => 'The bar option',
            ),
        ];
    }

=head1 ATTRIBUTES

=head2 name

The name of the attribute that must be specified on the command line.
This name follows Getopt::Long rules, so its usage can be reduced to
the shortest unambiguous specification. In other words, if the options
'fibonacci' and 'fortune' are options to the same script, then --fi
and --fo are valid options but -f (or --f) are not because of the
ambiguity between the two options.

=head2 display

The name as it is displayed in a usage (--help) option (switch) table.
By default, it is the same as the name; this method is provided for
cases in which it may be helpful to have a usage statement that shows
a sample value such as '--max-timeout=<timeout>' rather than simply
saying '--max-timeout', because the meaning of --max-timeout is then



( run in 0.541 second using v1.01-cache-2.11-cpan-39bf76dae61 )