Custom/Constraints.pm

filter: Statementstmt 100% 13 / 13 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 73.0% 19 / 26 CC 4 SCAR 11.2
CC
4
Cov
80%
AUTOLOAD
4.6
BEGIN
1.0
BEGIN
1.0
CRAP 3.1
« Custom/Rule.pm ↑ Summary Custom/Result.pm »
1 # Version 0 module
2 package Validator::Custom::Constraints;
3 5 ▶use Object::Simple -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 has 'constraints';
8  
9 5 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=4 SCAR=15.2
10 5 my $self = shift;
11  
12 5 my ($package, $method) = split /::(\w+)$/, our $AUTOLOAD;
13 5 ▶ Carp::croak "Undefined subroutine &${package}::$method called"
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($self) and $self->isa(__PACKAGE__) 0 5 5
Condition33%1/3
builtin::blessed($self) and $self->isa(__PACKAGE__)
!ll&&!rl&&r
005
MC/DC0%0/2
builtin::blessed($self) and $self->isa(__PACKAGE__)
builtin::blessed($self) $self->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= builtin::blessed($self)B= $self->isa(__PACKAGE__)
ABresult
0X0
100
111
14 unless Scalar::Util::blessed $self && $self->isa(__PACKAGE__);
15  
16 # Call helper with current controller
17 Carp::croak qq{Can't locate object method "$method" via package "$package"}
18 5 ▶ unless my $helper = $self->constraints->{$method};
Branch: 1 branch
BranchTrueFalseTotal
unless my $helper = $self->constraints->{$method} 0 5 5
19 5 return $helper->(@_);
20 }
21  
22 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
23  
24 5 1;
25  
26 =head1 NAME
27  
28 Validator::Custom::Constraints - Constraint autoloading system
« Custom/Rule.pm ↑ Summary Custom/Result.pm »