| 1 | package Valiant::Proxy::Array; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | with 'Valiant::Proxy'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | sub read_attribute_for_validation { | ||||||||||||||||||||||||||||
| 7 | 35 | ▶ | my ($self, $attribute) = @_; | ||||||||||||||||||||||||||
|
Subroutine
read_attribute_for_validation: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 8 | 35 | ▶ | if( $attribute=~m/^\d+$/ && defined $self->for->[$attribute]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$attribute =~ /^\d+$/ and defined $self->for->[$attribute]
MC/DC50%1/2
$attribute =~ /^\d+$/ and defined $self->for->[$attribute]
$attribute =~ /^\d+$/
defined $self->for->[$attribute]
Truth table66%2/3
A and B
A= $attribute =~ /^\d+$/B= defined $self->for->[$attribute]
| |||||||||||||||||||||||||||||
| 9 | 28 | return $self->for->[$attribute]; | |||||||||||||||||||||||||||
| 10 | } else { | ||||||||||||||||||||||||||||
| 11 | 7 | return undef; # TODO Might need a flag to allow die here? | |||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | 1; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 NAME | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | Valiant::Proxy::Array - Wrap a hashref in a result object for validation. | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | TBD | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | Allows you to run validations against a HashRef. | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | You probably won't use this directly (although you can) since we have L<Valiant::Class> to | ||||||||||||||||||||||||||||
| 30 | encapsulate the most common patterns for this need. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | This does the interface defined by L<Valiant::Result> so see the docs on that. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Also: L<Valiant>, L<Valiant::Validator>, L<Valiant::Validator::Each>. | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | See L<Valiant> | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | See L<Valiant> | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | =cut | ||||||||||||||||||||||||||||