| 1 | package Catalyst::Controller::DBIC::API::Validator::Visitor; | ||||||||||||||||||||||||||||
| 2 | 16 | $Catalyst::Controller::DBIC::API::Validator::Visitor::VERSION = '2.009000'; | |||||||||||||||||||||||||||
| 3 | #ABSTRACT: Provides validation services for inbound requests against whitelisted parameters | ||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 16 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 16 | ▶ | BEGIN { extends 'Data::DPath::Validator::Visitor'; } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 16 | ▶ | use constant DEBUG => $ENV{DATA_DPATH_VALIDATOR_DEBUG} || 0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.1
Condition50%1/2
$ENV{'DATA_DPATH_VALIDATOR_DEBUG'} || 0
MC/DC0%0/1
$ENV{'DATA_DPATH_VALIDATOR_DEBUG'} || 0
$ENV{'DATA_DPATH_VALIDATOR_DEBUG'}
Truth table50%1/2
A
A= $ENV{'DATA_DPATH_VALIDATOR_DEBUG'}
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 46 | ▶ | around visit_array => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.9
| |||||||||||||||||||||||||||||
| 13 | 46 | my ( $orig, $self, $array ) = @_; | |||||||||||||||||||||||||||
| 14 | 46 | $self->dive(); | |||||||||||||||||||||||||||
| 15 | 46 | warn 'ARRAY: ' . $self->current_template if DEBUG; | |||||||||||||||||||||||||||
| 16 | 46 | ▶ | if ( @$array == 1 && $array->[0] eq '*' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$array == 1 and $array->[0] eq "*"
MC/DC50%1/2
@$array == 1 and $array->[0] eq "*"
@$array == 1
$array->[0] eq "*"
Truth table66%2/3
A and B
A= @$array == 1B= $array->[0] eq "*"
| |||||||||||||||||||||||||||||
| 17 | 23 | $self->append_text('[reftype eq "HASH" ]'); | |||||||||||||||||||||||||||
| 18 | 23 | $self->add_template( $self->current_template ); | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | else { | ||||||||||||||||||||||||||||
| 21 | 23 | ▶ | if ( $self->current_template =~ /\/$/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 0 | my $temp = $self->current_template; | |||||||||||||||||||||||||||
| 23 | 0 | $self->reset_template(); | |||||||||||||||||||||||||||
| 24 | 0 | $temp =~ s/\/$//; | |||||||||||||||||||||||||||
| 25 | 0 | $self->append_text($temp); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | 23 | $self->$orig($array); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 46 | $self->rise(); | |||||||||||||||||||||||||||
| 30 | 16 | }; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 92 | ▶ | sub visit_array_entry { | ||||||||||||||||||||||||||
|
Subroutine
visit_array_entry: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # to make release-unused-vars.t happy | ||||||||||||||||||||||||||||
| 35 | #my ($self, $elem, $index, $array) = @_; | ||||||||||||||||||||||||||||
| 36 | 92 | my ( $self, $elem ) = @_; | |||||||||||||||||||||||||||
| 37 | 92 | $self->dive(); | |||||||||||||||||||||||||||
| 38 | 92 | warn 'ARRAYENTRY: ' . $self->current_template if DEBUG; | |||||||||||||||||||||||||||
| 39 | 92 | ▶ | if ( !ref($elem) ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 40 | 69 | $self->append_text( $elem . '/*' ); | |||||||||||||||||||||||||||
| 41 | 69 | $self->add_template( $self->current_template ); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | elsif ( ref($elem) eq 'HASH' ) { | ||||||||||||||||||||||||||||
| 44 | 23 | $self->visit($elem); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | 92 | $self->rise(); | |||||||||||||||||||||||||||
| 47 | 92 | $self->value_type('NONE'); | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 47 | ▶ | around visit_hash => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 51 | 47 | my ( $orig, $self, $hash ) = @_; | |||||||||||||||||||||||||||
| 52 | 47 | $self->dive(); | |||||||||||||||||||||||||||
| 53 | 47 | ▶ | if ( $self->current_template =~ /\/$/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 47 | my $temp = $self->current_template; | |||||||||||||||||||||||||||
| 55 | 47 | $self->reset_template(); | |||||||||||||||||||||||||||
| 56 | 47 | $temp =~ s/\/$//; | |||||||||||||||||||||||||||
| 57 | 47 | $self->append_text($temp); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 47 | warn 'HASH: ' . $self->current_template if DEBUG; | |||||||||||||||||||||||||||
| 60 | 47 | $self->$orig($hash); | |||||||||||||||||||||||||||
| 61 | 47 | $self->rise(); | |||||||||||||||||||||||||||
| 62 | 16 | }; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 107 | ▶ | around visit_value => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 65 | 107 | my ( $orig, $self, $val ) = @_; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 107 | ▶ | if ( $self->value_type eq 'NONE' ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 68 | 59 | $self->dive(); | |||||||||||||||||||||||||||
| 69 | 59 | $self->append_text( $val . '/*' ); | |||||||||||||||||||||||||||
| 70 | 59 | $self->add_template( $self->current_template ); | |||||||||||||||||||||||||||
| 71 | 59 | warn 'VALUE: ' . $self->current_template if DEBUG; | |||||||||||||||||||||||||||
| 72 | 59 | $self->rise(); | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | elsif ( $self->value_type eq 'HashKey' ) { | ||||||||||||||||||||||||||||
| 75 | 47 | $self->append_text($val); | |||||||||||||||||||||||||||
| 76 | 47 | warn 'VALUE: ' . $self->current_template if DEBUG; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | else { | ||||||||||||||||||||||||||||
| 79 | 1 | $self->$orig($val); | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 16 | }; | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 16 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 16 | 1; | |||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | __END__ | ||||||||||||||||||||||||||||