Rx/CoreType/all.pm

filter: Statementstmt 100% 29 / 29 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 83.3% 45 / 54 CC 7 SCAR 12.9
CC
7
Cov
90%
guts_from_arg
6.3
assert_valid
2.0
BEGIN
1.0
CRAP 3.6
« Rx/Util.pm ↑ Summary Rx/CoreType/any.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Data::Rx::CoreType::all;
4 # ABSTRACT: the Rx //all type
5 1 $Data::Rx::CoreType::all::VERSION = '0.200007';
6 1 ▶use parent 'Data::Rx::CoreType';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub guts_from_arg {
11 4 ▶ my ($class, $arg, $rx, $type) = @_;
Subroutine guts_from_arg: called CC=6 SCAR=18.5
Pod undocumented
12  
13 4 ▶ Carp::croak("unknown arguments to new")
Branch: 1 branch
BranchTrueFalseTotal
unless "Data::Rx::Util"->_x_subset_keys_y($arg, {"of", 1}) 0 4 4
14 unless Data::Rx::Util->_x_subset_keys_y($arg, { of => 1});
15  
16 4 ▶ Carp::croak("no 'of' parameter given to //all") unless exists $arg->{of};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"of"} 1 3 4
17  
18 3 my $of = $arg->{of};
19  
20 3 ▶ Carp::croak("invalid 'of' argument to //all") unless
Branch: 1 branch
BranchTrueFalseTotal
unless defined $of and builtin::reftype($of) eq "ARRAY" and @$of 1 2 3
Condition50%3/6
defined $of and builtin::reftype($of) eq "ARRAY" and @$of
!ll&&!rl&&r
012
defined $of and builtin::reftype($of) eq "ARRAY"
!ll&&!rl&&r
003
MC/DC33%1/3
defined $of and builtin::reftype($of) eq "ARRAY" and @$of
defined $of builtin::reftype($of) eq "ARRAY" @$of
Truth table50%2/4
A and B and C
A= defined $ofB= builtin::reftype($of) eq "ARRAY"C= @$of
ABCresult
0XX0
10X0
1100
1111
21 defined $of and Scalar::Util::reftype $of eq 'ARRAY' and @$of;
22  
23 2 return { of => [ map {; $rx->make_schema($_) } @$of ] };
24 }
25  
26 sub assert_valid {
27 53 ▶ my ($self, $value) = @_;
Subroutine assert_valid: called CC=2 SCAR=6.9
Pod undocumented
28  
29 53 my @subchecks;
30 53 for my $i (0 .. $#{ $self->{of} }) {
31 push @subchecks, [
32 $value,
33 106 $self->{of}[$i],
34 {
35 check_path => [ [ 'of', 'key'], [ $i, 'index' ] ],
36 }
37 ];
38 }
39  
40 53 $self->perform_subchecks(\@subchecks);
41  
42 2 return 1;
43 }
44  
45 54 ▶sub subname { 'all' }
Subroutine subname: called CC=1 SCAR=0.0
Pod undocumented
46  
47 1 1;
48  
49 __END__
« Rx/Util.pm ↑ Summary Rx/CoreType/any.pm »