| 1 | package Getopt::Yath::Option::Count; | ||||||||||||||||||||
| 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 | |||||||||||||||||||||
| 7 | 1 | our $VERSION = '2.000007'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use parent 'Getopt::Yath::Option'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use Getopt::Yath::HashBase; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 9 | ▶ | sub allows_shortval { 0 } | ||||||||||||||||||
|
Subroutine
allows_shortval: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 13 | 3 | ▶ | sub allows_arg { 1 } | ||||||||||||||||||
|
Subroutine
allows_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 14 | 10 | ▶ | sub requires_arg { 0 } | ||||||||||||||||||
|
Subroutine
requires_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 15 | 7 | ▶ | sub allows_autofill { 0 } | ||||||||||||||||||
|
Subroutine
allows_autofill: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 16 | 1 | ▶ | sub requires_autofill { 0 } | ||||||||||||||||||
|
Subroutine
requires_autofill: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 17 | 47 | ▶ | sub is_populated { 1 } # Always populated | ||||||||||||||||||
|
Subroutine
is_populated: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 7 | ▶ | sub no_arg_value { () } | ||||||||||||||||||
|
Subroutine
no_arg_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 3 | ▶ | sub clear_field { ${$_[1]} = 0 } # --no-count | ||||||||||||||||||
|
Subroutine
clear_field: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | # Autofill should be 0 if not specified | ||||||||||||||||||||
| 24 | 0 | ▶ | sub get_autofill_value { $_[0]->SUPER::get_autofill_value() // 0 } | ||||||||||||||||||
|
Subroutine
get_autofill_value: not called CC=2 SCAR=17.9
Pod
undocumented
Condition0%0/2
$_[0]->SUPER::get_autofill_value // 0
MC/DC0%0/1
$_[0]->SUPER::get_autofill_value // 0
$_[0]->SUPER::get_autofill_value
Truth table0%0/2
A
A= $_[0]->SUPER::get_autofill_value
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 2 | ▶ | sub default_long_examples {my $self = shift; ['', '=COUNT'] } | ||||||||||||||||||
|
Subroutine
default_long_examples: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 27 | 2 | ▶ | sub default_short_examples {my $self = shift; ['', $self->short, ($self->short x 2) . '..', '=COUNT'] } | ||||||||||||||||||
|
Subroutine
default_short_examples: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 2 | ▶ | sub notes { (shift->SUPER::notes(), 'Can be specified multiple times, counter bumps each time it is used.') } | ||||||||||||||||||
|
Subroutine
notes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | # --count | ||||||||||||||||||||
| 32 | # --count=5 | ||||||||||||||||||||
| 33 | sub add_value { | ||||||||||||||||||||
| 34 | 61 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
add_value: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 35 | 61 | my ($ref, @val) = @_; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | # Explicit value set | ||||||||||||||||||||
| 38 | 61 | ▶ | return $$ref = $val[0] if @val; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | # Make sure we have a sane start | ||||||||||||||||||||
| 41 | 7 | ▶ | $$ref //= $self->get_autofill_value; | ||||||||||||||||||
|
Condition33%1/3
$$ref //= $self->get_autofill_value
MC/DC0%0/2
$$ref //= $self->get_autofill_value
$$ref
$self->get_autofill_value
Truth table33%1/3
A //= B
A= $$refB= $self->get_autofill_value
| |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | # Bump by one | ||||||||||||||||||||
| 44 | 7 | return ${$ref}++; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | 48 | ▶ | sub can_set_env { 1 } | ||||||||||||||||||
|
Subroutine
can_set_env: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | sub get_env_value { | ||||||||||||||||||||
| 50 | 0 | ▶ | my $opt = shift; | ||||||||||||||||||
|
Subroutine
get_env_value: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 51 | 0 | my ($var, $ref) = @_; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | ▶ | return $$ref unless $var =~ m/^!/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 54 | 0 | ▶ | return $ref ? 0 : 1; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||