01 Jul 2022 03:07:52 UTC
- Distribution: Getopt-EX
- Module version: v1.28.0
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- KwaliteeBus factor: 1
- 70.60% Coverage
- License: perl_5
- Perl: v5.14.0
- Download (44.4KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- Kazumasa Utashiro
Getopt::EX::LabeledParam - Labeled parameter handling
GetOptions('colormap|cm:s' => @opt_colormap); my %colormap; my @colors; require Getopt::EX::LabeledParam; my $cmap = Getopt::EX::LabeledParam->new( NEWLABEL => 0, HASH => \%colormap, LIST => \@colors, ); $cmap->append(@opt_colormap);
This module implements super class of Getopt::EX::Colormap.
Parameters can be given in two ways: one in labeled table, and one in indexed list.
Basically, labeled parameter is defined by LABEL=VALUE notation:
Definition can be connected by comma (
Multiple labels can be set for same value:
?can be used in label name, and they matches existing hash key name. If labels
NEW_FILEexists in hash,
produces same result.
If VALUE part start with plus (
+) character, it is appended to current value. At this time,
CONCATstring is inserted before additional string. Default
CONCATstrings is empty, so use configure method to set. If VALUE part start with minus (
-) character, following characters are deleted from the current value.
If LABEL= part is omitted, values are treated anonymous list and stored in list object. For example,
makes six entries in the list. The list object is accessed by index, rather than label.
Handler maintains hash and list objects, and labeled values are stored in hash, non-label values are in list automatically. User can mix both specifications.
When the value field has a special form of function call, Getopt::EX::Func object is created and stored for that entry. See "FUNCTION SPEC" section in Getopt::EX::Colormap for more detail. Module should have switch to enable this capability, but not now.
- HASH => hashref
- LIST => listref
HASH and LIST reference can be set by new or configure method. You can provide default setting of hash and list, and it is usually easier to access those values directly, rather than through class methods.
- NEWLABEL => 0/1
By default, load_params does not create new entry in colormap table, and absent label is ignored. Setting <NEWLABEL> parameter true makes it possible create a new hash entry.
- CONCAT => string
Set concatination string inserted before appending string.
- append HASHREF or LIST
Append colormap hash or color list. If a hash reference is given, all entry of the hash is appended to the colormap. Otherwise, they are appended anonymous color list.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|