| 1 | package Getopt::Yath::Option; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | our @CARP_NOT = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 'Getopt::Yath', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 'Getopt::Yath::Instance', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Getopt::Yath::Util qw/mod2file fqmod/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Getopt::Yath::Term qw/USE_COLOR color/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | our $VERSION = '2.000007'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | use Getopt::Yath::HashBase qw{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | <title | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | <field <name <short <alt <alt_no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | <allow_underscore_in_alt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | <group | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | <prefix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | <trace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | <module <no_module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | <maybe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | <applicable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | <default <autofill <initialize <clear | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | <default_text <autofill_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | <normalize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | +trigger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | <allowed_values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | <allowed_values_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | <from_env_vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | <clear_env_vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | <set_env_vars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | <category | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | <description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | +short_examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | +long_examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | +forms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | <mod_adds_options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | <notes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub requires_arg { croak "'$_[0]' does not define requires_arg()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requires_arg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub add_value { croak "'$_[0]' does not define add_value()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub is_populated { croak "'$_[0]' does not define is_populated()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_populated: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub no_arg_value { croak "'$_[0]' does not define no_arg_value()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_arg_value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub get_env_value { croak "'$_[0]' does not define get_env_value()" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_env_value: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 80 | ▶ | sub can_set_env { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_set_env: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub requires_autofill { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requires_autofill: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 25 | ▶ | sub allows_shortval { $_[0]->allows_arg } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allows_shortval: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub allows_default { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allows_default: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 16 | ▶ | sub allows_list { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allows_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub allows_arg { $_[0]->requires_arg } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allows_arg: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub allows_autofill { $_[0]->requires_autofill } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
allows_autofill: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 7 | ▶ | sub get_autofill_value { shift->_get___value(AUTOFILL(), @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_autofill_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 354 | ▶ | sub get_default_value { shift->_get___value(DEFAULT(), @_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_default_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ▶ | sub init_settings { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_settings: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ▶ | sub finalize_settings { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_settings: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | sub create { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 16 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 16 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 16 | ▶ | croak "create() cannot be called on an option subclass" unless $class eq __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 16 | ▶ | my $type = delete $params{type} or croak "No 'type' specified"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 16 | my $new_class = fqmod($type, __PACKAGE__); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 16 | local $Carp::CarpLevel = $Carp::CarpLevel = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | return $new_class->new(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | sub get_initial_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 389 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_initial_value: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 389 | my $env = $self->from_env_vars; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 389 | ▶ | for my $name (@{$env || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 19 | my $env = "$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 19 | $env =~ s/^(!)//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 19 | my $neg = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 19 | ▶ | next unless exists $ENV{$env}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 9 | ▶ | return $ENV{$env} unless $neg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 2 | ▶ | return $ENV{$env} ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 380 | return $self->_get___value(INITIALIZE(), @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | sub get_clear_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_clear_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | return $self->_get___value(CLEAR(), @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | sub _get___value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 833 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get___value: called CC=6 SCAR=18.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 833 | my ($field, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 833 | ▶ | return undef if $self->{+MAYBE} && $field eq INITIALIZE(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"maybe"} and $field eq "initialize"
MC/DC0%0/2
$self->{"maybe"} and $field eq "initialize"
$self->{"maybe"}
$field eq "initialize"
Truth table33%1/3
A and B
A= $self->{"maybe"}B= $field eq "initialize"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 833 | ▶ | return unless exists $self->{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 294 | my $val = $self->{$field}; # May be undef, that is fine if specified. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 294 | ▶ | return $val unless ref($val); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 68 | ▶ | croak "'$field' values must either be simple scalars (not references) or a code ref that returns the '$field' value" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | unless ref($val) eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 68 | return $self->$val(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | sub normalize_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 34 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_value: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 34 | my (@input) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 34 | ▶ | my $cb = $self->{+NORMALIZE} or return @input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return $cb->(@input); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | sub trigger { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 531 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trigger: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 531 | ▶ | my $cb = $self->{+TRIGGER} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 66 | $self->$cb(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | sub clear_field { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_field: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 6 | my ($ref) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | return $$ref = $self->get_clear_value(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | sub is_applicable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 503 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_applicable: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 503 | my ($options, $settings) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 503 | ▶ | my $cb = $self->{+APPLICABLE} or return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return $self->$cb($options, $settings); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | sub long_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
long_args: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | return ($self->{+NAME}, @{$self->{+ALT} || []}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | sub trace_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trace_string: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | my $trace = $self->{+TRACE} or return "[UNKNOWN]"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | return "$trace->[1] line $trace->[2]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | sub long_examples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 28 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
long_examples: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 28 | ▶ | return @{$self->{+LONG_EXAMPLES}} if $self->{+LONG_EXAMPLES}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 28 | return @{$self->default_long_examples(@_)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | sub short_examples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 16 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
short_examples: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 16 | ▶ | return @{$self->{+SHORT_EXAMPLES}} if $self->{+SHORT_EXAMPLES}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 16 | return @{$self->default_short_examples(@_)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 16 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=43 SCAR=46.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | croak "A trace is required" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 16 | ▶ | unless $self->{+TRACE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | croak "You must provide either 'module' (a module name for dynamic loading) or set 'no_module'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 16 | ▶ | unless $self->{+MODULE} || $self->{+NO_MODULE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"module"} or $self->{"no_module"}
MC/DC0%0/2
$self->{"module"} or $self->{"no_module"}
$self->{"module"}
$self->{"no_module"}
Truth table66%2/3
A or B
A= $self->{"module"}B= $self->{"no_module"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | croak "You must specify 'title' or both 'field' and 'name'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 16 | ▶ | unless $self->{+TITLE} || ($self->{+FIELD} && $self->{+NAME}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
$self->{"title"} or $self->{"field"} and $self->{"name"}
$self->{"field"} and $self->{"name"}
MC/DC0%0/3
$self->{"title"} or $self->{"field"} and $self->{"name"}
$self->{"title"}
$self->{"field"}
$self->{"name"}
Truth table25%1/4
A or B and C
A= $self->{"title"}B= $self->{"field"}C= $self->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | croak "The 'group' attribute is required" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 16 | ▶ | unless $self->{+GROUP}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | croak "'set_env_vars' is not supported for this option type" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 16 | ▶ | if $self->{+SET_ENV_VARS} && !$self->can_set_env; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"set_env_vars"} and not $self->can_set_env
MC/DC0%0/2
$self->{"set_env_vars"} and not $self->can_set_env
$self->{"set_env_vars"}
not $self->can_set_env
Truth table66%2/3
A and not(B)
A= $self->{"set_env_vars"}B= not $self->can_set_env
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | croak "The 'alt' attribute must be an array-ref" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 16 | ▶ | if $self->{+ALT} && ref($self->{+ALT}) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"alt"} and ref $self->{"alt"} ne "ARRAY"
MC/DC0%0/2
$self->{"alt"} and ref $self->{"alt"} ne "ARRAY"
$self->{"alt"}
ref $self->{"alt"} ne "ARRAY"
Truth table66%2/3
A and B
A= $self->{"alt"}B= ref $self->{"alt"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | croak "The 'alt_no' attribute must be an array-ref" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 16 | ▶ | if $self->{+ALT_NO} && ref($self->{+ALT_NO}) ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"alt_no"} and ref $self->{"alt_no"} ne "ARRAY"
MC/DC0%0/2
$self->{"alt_no"} and ref $self->{"alt_no"} ne "ARRAY"
$self->{"alt_no"}
ref $self->{"alt_no"} ne "ARRAY"
Truth table33%1/3
A and B
A= $self->{"alt_no"}B= ref $self->{"alt_no"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 16 | ▶ | $self->{+MODULE} //= $self->{+TRACE}->[0] unless $self->{+NO_MODULE}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"module"} //= $self->{"trace"}[0]
MC/DC0%0/2
$self->{"module"} //= $self->{"trace"}[0]
$self->{"module"}
$self->{"trace"}[0]
Truth table33%1/3
A //= B
A= $self->{"module"}B= $self->{"trace"}[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 16 | ▶ | if (my $title = $self->{+TITLE}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 16 | ▶ | $self->{+FIELD} //= $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"field"} //= $title
MC/DC0%0/2
$self->{"field"} //= $title
$self->{"field"}
$title
Truth table33%1/3
A //= B
A= $self->{"field"}B= $title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 16 | ▶ | $self->{+NAME} //= $title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"name"} //= $title
MC/DC0%0/2
$self->{"name"} //= $title
$self->{"name"}
$title
Truth table33%1/3
A //= B
A= $self->{"name"}B= $title
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 16 | $self->{+FIELD} =~ s/-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 16 | $self->{+NAME} =~ s/_/-/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 16 | ▶ | unless ($self->allow_underscore_in_alt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 16 | ▶ | for my $alt (@{$self->{+ALT} // []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"alt"} // []
MC/DC100%1/1
$self->{"alt"} // []
$self->{"alt"}
Truth table100%2/2
A
A= $self->{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 3 | ▶ | next unless $alt =~ m/_/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | croak "alt option form '$alt' contains an underscore, replace it with a '-' or set 'allow_underscore_in_alt' to true"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | croak "'default' is not allowed (did you mean 'initialize'" . ($self->allows_autofill ? " or 'autofill'" : "") . "?)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 16 | ▶ | if $self->{+DEFAULT} && !$self->allows_default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$self->{"default"} and not $self->allows_default
MC/DC0%0/2
$self->{"default"} and not $self->allows_default
$self->{"default"}
not $self->allows_default
Truth table66%2/3
A and not(B)
A= $self->{"default"}B= not $self->allows_default
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 16 | ▶ | croak "'autofill' is required" if $self->requires_autofill && !$self->{+AUTOFILL}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->requires_autofill and not $self->{"autofill"}
MC/DC100%2/2
$self->requires_autofill and not $self->{"autofill"}
$self->requires_autofill
not $self->{"autofill"}
Truth table100%3/3
A and not(B)
A= $self->requires_autofillB= not $self->{"autofill"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 15 | ▶ | croak "'autofill' is not allowed" if $self->{+AUTOFILL} && !$self->allows_autofill; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"autofill"} and not $self->allows_autofill
MC/DC0%0/2
$self->{"autofill"} and not $self->allows_autofill
$self->{"autofill"}
not $self->allows_autofill
Truth table66%2/3
A and not(B)
A= $self->{"autofill"}B= not $self->allows_autofill
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 15 | for my $field (DEFAULT(), AUTOFILL(), INITIALIZE()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 45 | ▶ | my $val = $self->{$field} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 12 | ▶ | my $ref = ref($val) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 6 | ▶ | croak "'$field' must be a simple scalar, or a coderef, got a '$ref'" if $ref && $ref ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ref and $ref ne "CODE"
MC/DC0%0/2
$ref and $ref ne "CODE"
$ref
$ref ne "CODE"
Truth table33%1/3
A and B
A= $refB= $ref ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 15 | for my $field (NORMALIZE(), APPLICABLE(), TRIGGER()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 45 | ▶ | my $val = $self->{$field} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | my $ref = ref($val) || 'not a ref'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
ref $val || 'not a ref'
MC/DC0%0/1
ref $val || 'not a ref'
ref $val
Truth table50%1/2
A
A= ref $val
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | ▶ | next if $ref eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | croak "'$field' must be undef, or a coderef, got '$ref'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 15 | ▶ | $self->{+CATEGORY} //= 'NO CATEGORY - FIX ME'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"category"} //= "NO CATEGORY - FIX ME"
MC/DC0%0/1
$self->{"category"} //= "NO CATEGORY - FIX ME"
$self->{"category"}
Truth table50%1/2
A
A= $self->{"category"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 15 | ▶ | $self->{+DESCRIPTION} //= 'NO DESCRIPTION - FIX ME'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"description"} //= "NO DESCRIPTION - FIX ME"
MC/DC100%1/1
$self->{"description"} //= "NO DESCRIPTION - FIX ME"
$self->{"description"}
Truth table100%2/2
A
A= $self->{"description"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 15 | for my $key (sort keys %$self) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 156 | ▶ | croak "'$key' is not a valid option attribute" unless $self->can(uc($key)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 15 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | sub check_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 44 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_value: called CC=17 SCAR=51.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 44 | my ($val) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 44 | ▶ | return unless defined $val; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 44 | ▶ | $val = [$val] unless ref($val) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 44 | ▶ | my $av = $self->allowed_values or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $r = ref($av); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | my @bad; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | for my $v (@$val) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $ok = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | if ($r eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | $ok = $self->$av($v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | elsif ($r =~ /Regex/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $ok = $v =~ $av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | elsif($r eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $ok = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | for my $c (@$av) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | next unless defined $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | $ok = 1 and last if $c eq $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$c eq $v && (($ok = 1) && (last))
$ok = 1 and last
MC/DC0%0/2
$c eq $v && (($ok = 1) && (last))
$c eq $v
$ok = 1
Truth table0%0/3
A && B
A= $c eq $vB= $ok = 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | $ok = 1 and last if 0+$c && 0+$v && $c == $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/11
0 + $c && 0 + $v && $c == $v && (($ok = 1) && (last))
0 + $c and 0 + $v and $c == $v
0 + $c and 0 + $v
$ok = 1 and last
MC/DC0%0/4
0 + $c && 0 + $v && $c == $v && (($ok = 1) && (last))
0 + $c
0 + $v
$c == $v
$ok = 1
Truth table0%0/5
A and B and C && D
A= 0 + $cB= 0 + $vC= $c == $vD= $ok = 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | die "Invalid value check '$av' ($r) defined at " . $self->trace_string . ".\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | next if $ok; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | push @bad => $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return @bad; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | sub forms { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 509 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
forms: called CC=11 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 509 | ▶ | return $self->{+FORMS} if $self->{+FORMS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 15 | my $forms = $self->{+FORMS} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 15 | ▶ | $forms->{'-' . $self->{+SHORT}} = 1 if $self->{+SHORT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 15 | ▶ | my $prefix = $self->prefix // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->prefix // ""
MC/DC0%0/1
$self->prefix // ""
$self->prefix
Truth table50%1/2
A
A= $self->prefix
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 15 | ▶ | $prefix .= '-' if length $prefix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 15 | ▶ | $forms->{$_} = 1 for map { "--${prefix}$_" } @{$self->{+ALT} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"alt"} // []
MC/DC100%1/1
$self->{"alt"} // []
$self->{"alt"}
Truth table100%2/2
A
A= $self->{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 15 | ▶ | $forms->{$_} = -1 for map { "--no-${prefix}$_" } @{$self->{+ALT} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"alt"} // []
MC/DC100%1/1
$self->{"alt"} // []
$self->{"alt"}
Truth table100%2/2
A
A= $self->{"alt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 15 | ▶ | $forms->{$_} = -1 for map { "--${prefix}$_" } @{$self->{+ALT_NO} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"alt_no"} // []
MC/DC0%0/1
$self->{"alt_no"} // []
$self->{"alt_no"}
Truth table50%1/2
A
A= $self->{"alt_no"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 15 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 15 | $forms->{"--${prefix}${name}"} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 15 | $forms->{"--no-${prefix}${name}"} = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 15 | return $forms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | sub _example_append { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 24 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_example_append: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 24 | my ($params, @prefixes) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 24 | ▶ | return unless $self->allows_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 8 | ▶ | my $groups = $params->{groups} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$params->{"groups"} // {}
MC/DC100%1/1
$params->{"groups"} // {}
$params->{"groups"}
Truth table100%2/2
A
A= $params->{"groups"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 8 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 8 | for my $prefix (@prefixes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 12 | for my $group (sort keys %$groups) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 6 | push @out => "${prefix}${group} ARG1 ARG2 ... $groups->{$group}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 8 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | sub default_long_examples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 26 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_long_examples: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 26 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 26 | ▶ | return [''] unless $self->allows_arg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 20 | ▶ | if ($self->requires_arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 12 | return [' ARG', '=ARG', $self->_example_append(\%params, ' ', '=')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 8 | return ['', '=ARG', $self->_example_append(\%params, '=')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | sub default_short_examples { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_short_examples: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 6 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 6 | ▶ | return [''] unless $self->allows_arg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 4 | ▶ | if ($self->requires_arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 2 | ▶ | return ['ARG', ' ARG', '=ARG', $self->_example_append(\%params, '', ' ', '=')] if $self->allows_shortval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | return [' ARG', '=ARG', $self->_example_append(\%params, ' ', '=')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 2 | ▶ | return ['', 'ARG', '=ARG', $self->_example_append(\%params, '', '=')] if $self->allows_shortval; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return ['', '=ARG', $self->_example_append(\%params, '=')]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | sub doc_forms { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 28 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
doc_forms: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 28 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 28 | my $name = $self->{+NAME}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 28 | ▶ | my $prefix = $self->{+PREFIX} ? "$self->{+PREFIX}-" : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 28 | my @long_examples = $self->long_examples(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 28 | my @forms = (map { "--${prefix}${name}${_}" } @long_examples ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 28 | ▶ | for my $alt (@{$self->{+ALT} || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 6 | push @forms => (map { "--${prefix}${alt}${_}" } @long_examples); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 28 | ▶ | if (my $short = $self->{+SHORT}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 16 | my @short_examples = $self->short_examples(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 16 | push @forms => map { "-${short}${_}" } @short_examples; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | @forms = sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 28 | $a =~ m/^(-+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 195 | ▶ | my $al = length($1 // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$1 // ""
MC/DC0%0/1
$1 // ""
$1
Truth table50%1/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 195 | $b =~ m/^(-+)/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 195 | ▶ | my $bl = length($1 // ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$1 // ""
MC/DC0%0/1
$1 // ""
$1
Truth table50%1/2
A
A= $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 195 | ▶ | $al <=> $bl || length($a) <=> length($b); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } @forms; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 28 | my @no_forms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 28 | push @no_forms => "--no-${prefix}${name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 28 | ▶ | push @no_forms => map { "--$_" } @{$self->{+ALT_NO} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"alt_no"} // []
MC/DC0%0/1
$self->{"alt_no"} // []
$self->{"alt_no"}
Truth table50%1/2
A
A= $self->{"alt_no"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 28 | return \@forms, \@no_forms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | sub cli_docs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cli_docs: called CC=21 SCAR=36.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 14 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 14 | ▶ | $params{color} //= USE_COLOR && -t STDOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$params{"color"} //= -t STDOUT
MC/DC0%0/2
$params{"color"} //= -t STDOUT
$params{"color"}
-t STDOUT
Truth table33%1/3
A //= B
A= $params{"color"}B= -t STDOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 14 | my ($forms, $no_forms, $other_forms) = $self->doc_forms(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 14 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 14 | ▶ | if ($params{color}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | @out = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | color('underline white') . $self->{+NAME} . color('reset'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | (map { color('green') . $_ . color('reset') } @{$forms // []}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$forms // []
MC/DC0%0/1
$forms // []
$forms
Truth table0%0/2
A
A= $forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | (map { color('yellow') . $_ . color('reset') } @{$no_forms // []}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$no_forms // []
MC/DC0%0/1
$no_forms // []
$no_forms
Truth table0%0/2
A
A= $no_forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | (map { color('cyan') . $_ . color('reset') } @{$other_forms // []}), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$other_forms // []
MC/DC0%0/1
$other_forms // []
$other_forms
Truth table0%0/2
A
A= $other_forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | @out = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | "[$self->{+NAME}]", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 14 | ▶ | @{$forms // []}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$forms // []
MC/DC0%0/1
$forms // []
$forms
Truth table50%1/2
A
A= $forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 14 | ▶ | @{$no_forms // []}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$no_forms // []
MC/DC0%0/1
$no_forms // []
$no_forms
Truth table50%1/2
A
A= $no_forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 14 | ▶ | @{$other_forms // []}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$other_forms // []
MC/DC0%0/1
$other_forms // []
$other_forms
Truth table50%1/2
A
A= $other_forms
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 14 | push @out => Getopt::Yath::Term::fit_to_width(" ", $self->{+DESCRIPTION}, prefix => " "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 14 | ▶ | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "Can also be set with the following environment variables: " . join(", ", @{$self->{+FROM_ENV_VARS}}), prefix => " ") if $self->{+FROM_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 14 | ▶ | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "The following environment variables will be cleared after arguments are processed: " . join(", ", @{$self->{+CLEAR_ENV_VARS}}), prefix => " ") if $self->{+CLEAR_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 14 | ▶ | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "The following environment variables will be set after arguments are processed: " . join(", ", @{$self->{+SET_ENV_VARS}}), prefix => " ") if $self->{+SET_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 14 | ▶ | if (my @notes = $self->notes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 14 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 14 | ▶ | push @out => map { "\n" . Getopt::Yath::Term::fit_to_width(" ", "Note: $_", prefix => " ") } grep { $_ && !$seen{$_}++ } @notes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 14 | for my $field (qw/default autofill/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 28 | my $t = "${field}_text"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 28 | ▶ | my $val = $self->$t || $self->$field // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition80%4/5
($self->$t || $self->$field) // (next)
$self->$t or $self->$field
MC/DC50%1/2
($self->$t || $self->$field) // (next)
$self->$t
$self->$field
Truth table66%2/3
A or B
A= $self->$tB= $self->$field
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 12 | ▶ | next if ref($val); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 6 | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "$field: $val", prefix => " "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 14 | ▶ | if (my $avt = $self->allowed_values_text) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "Allowed Values: $avt", prefix => " "); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | elsif (my $vals = $self->allowed_values) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | push @out => "\n" . Getopt::Yath::Term::fit_to_width(" ", "Allowed Values: " . join(", " => @$vals), prefix => " ") if @$vals; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 14 | return join "\n" => @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | sub pod_docs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pod_docs: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 14 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 14 | my ($forms, $no_forms, $other_forms) = $self->doc_forms(%params); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 14 | my @out = map { "=item $_" } grep { $_ } @$forms, @$no_forms, @$other_forms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 14 | push @out => $self->description; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 14 | ▶ | push @out => "Can also be set with the following environment variables: " . join(", ", map { "C<$_>" } @{$self->{+FROM_ENV_VARS}}) if $self->{+FROM_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 14 | ▶ | push @out => "The following environment variables will be cleared after arguments are processed: " . join(", ", map { "C<$_>" } @{$self->{+CLEAR_ENV_VARS}}) if $self->{+CLEAR_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 14 | ▶ | push @out => "The following environment variables will be set after arguments are processed: " . join(", ", map { "C<$_>" } @{$self->{+SET_ENV_VARS}}) if $self->{+SET_ENV_VARS}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 14 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 14 | ▶ | push @out => map { "Note: $_" } grep { $_ && !$seen{$_}++ } $self->notes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 14 | return join("\n\n" => @out) . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||