CommandLineSwitch(3) User Contributed Perl Documentation CommandLineSwitch(3)NAMENOCpulse::CommandLineSwitch - Represents a command line switch as used
in CommandLineApplicationComponent.
DESCRIPTION
Switch definition includes a Getopt::Long spec, a required switch, a
default value, and short documentation. Logic includes switch
validation and documentation.
Note that this class is designed to be used with
CommandLineApplicationComponent, and as such it's very unlikely that
you'll ever directly interact with it or it's instances.
REQUIRES
NOCpulse::Object, Getopt::Long, Text::Wrap
EXPORTS
nothing
INSTANCE METHODSinstVarDefinitions()
Defines the following variables:
name - the name of the switch as it will appear in help and as it should be typed by the user
spec - specification of the contents of the switch a la Getopt::Long
required - whether or not this switch must be used (does not make much sense if there's a default value)
default - default value for this switch
value - the actual value of the switch after parsing
usage - string describing what this switch means and how it should be used
validated - whether or not this switch has been validated
isValid - whether or not this switch's value is valid given the spec and required
isValid(<component>)
Reports the validity of the switch's state. Requires that you pass
in the instance of the component that defines/owns the switch (done
for you by CommandLineApplicationComponent)
Returns true if:
- Getopt::Long is (or was - results are cached) happy with the value as regards the spec
Returns false if:
- Getopt::Long is unhappy with the switch value as regards the spec
OR
- The switch is required and there's no default and the user provides no value and the
command line application component provides no value via get_xxx (where
xxx is the name of this switch).
usage(<component>)
Returns a string that stands as documentation for the switch.
Requires that you pass in the CommandLineApplicationComponent that
defined/owns it. (Done for you by CommandLineApplicationComponent)
specAsType
Returns a string that describes this switch's data type
usageAsSql(<component>)
Returns a string that updates NOCpulse tables as to the usage of
this particular switch
invalidSwitchAsXML(<component>)
Returns a string that produces the switch documentation in XML
format, used during satellite configuration.
perl v5.14.0 2009-02-19 CommandLineSwitch(3)