| 1 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package HTML::FormFu::Constraint::AutoSet; | ||||||||||||||||||||||||||||
| 4 | 6 | $HTML::FormFu::Constraint::AutoSet::VERSION = '2.09'; | |||||||||||||||||||||||||||
| 5 | # ABSTRACT: Set Constraint for Selects / Radiogroups / Checkboxgroups | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | extends 'HTML::FormFu::Constraint::Set'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 9 | ▶ | sub process { | ||||||||||||||||||||||||||
|
Subroutine
process: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 9 | my @set = map { _parse_value($_) } @{ $self->parent->_options }; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 9 | $self->set( \@set ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 9 | return $self->SUPER::process(@_); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 27 | ▶ | sub _parse_value { | ||||||||||||||||||||||||||
|
Subroutine
_parse_value: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||
| 21 | 27 | my ($item) = @_; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 27 | ▶ | if ( exists $item->{group} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 2 | return map { _parse_value($_) } @{ $item->{group} }; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | else { | ||||||||||||||||||||||||||||
| 27 | # disabled attributes should be ignored | ||||||||||||||||||||||||||||
| 28 | 25 | ▶ | return if ( $item->{attributes} and $item->{attributes}->{disabled} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$item->{"attributes"} and $item->{"attributes"}{"disabled"}
MC/DC0%0/2
$item->{"attributes"} and $item->{"attributes"}{"disabled"}
$item->{"attributes"}
$item->{"attributes"}{"disabled"}
Truth table33%1/3
A and B
A= $item->{"attributes"}B= $item->{"attributes"}{"disabled"}
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # anything else is fine | ||||||||||||||||||||||||||||
| 31 | 25 | return $item->{value}; | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 6 | 1; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||||||||||