| 1 | package SyForm::FieldRole::Default; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | $SyForm::FieldRole::Default::AUTHORITY = 'cpan:GETTY'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | # ABSTRACT: A default for the field | ||||||||||||||||||||||||||||
| 6 | 6 | $SyForm::FieldRole::Default::VERSION = '0.103'; | |||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 6 | has default => ( | |||||||||||||||||||||||||||
| 10 | is => 'ro', | ||||||||||||||||||||||||||||
| 11 | predicate => 1, | ||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 38 | ▶ | around has_value_by_args => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 15 | 38 | my ( $orig, $self, %args ) = @_; | |||||||||||||||||||||||||||
| 16 | 38 | ▶ | return 1 if $self->$orig(%args); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 25 | ▶ | return 1 if $self->has_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 18 | return 0; | |||||||||||||||||||||||||||
| 19 | 6 | }; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 20 | ▶ | around get_value_by_process_args => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 22 | 20 | my ( $orig, $self, %args ) = @_; | |||||||||||||||||||||||||||
| 23 | 20 | ▶ | return $self->default if !exists($args{$self->name}) && $self->has_default; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not exists $args{$self->name} and $self->has_default
MC/DC50%1/2
not exists $args{$self->name} and $self->has_default
not exists $args{$self->name}
$self->has_default
Truth table66%2/3
not(A) and B
A= not exists $args{$self->name}B= $self->has_default
| |||||||||||||||||||||||||||||
| 24 | 13 | return $self->$orig(%args); | |||||||||||||||||||||||||||
| 25 | 6 | }; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 6 | 1; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | __END__ | ||||||||||||||||||||||||||||