blib/lib/Valiemon/Attributes.pm

filter: Statementstmt 90.6% 29 / 32 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 0.0% 0 / 3 totaltotal 83.6% 41 / 49 CC 3 SCAR 5.1
CC
3
Cov
92%
attr
3.0
attr_name
2.0
is_valid
2.0
CRAP 1.7
« blib/lib/Valiemon/Attributes/Enum.pm ↑ Summary blib/lib/Valiemon/Attributes/Format.pm »
1 package Valiemon::Attributes;
2 25 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 25 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 25 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 25 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 25 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 25 ▶use Class::Load qw(is_class_loaded try_load_class);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 25 ▶use Valiemon::ValidationError;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 25 our @EXPORT_OK = qw(attr);
12  
13 sub attr {
14 1300 ▶ my ($name) = @_;
Subroutine attr: called CC=3 SCAR=11.0
Pod undocumented
15 1300 $name =~ s/^\$//; # TODO have package mappings instead of dinamic load
16 1300 my $class = join '::', __PACKAGE__, (ucfirst $name);
17 1300 ▶ return $class if is_class_loaded($class);
Branch: 1 branch
BranchTrueFalseTotal
if is_class_loaded($class) 1096 204 1300
18  
19 204 my ($is_success) = try_load_class($class);
20 203 ▶ return $is_success ? $class : undef;
Branch: 1 branch
BranchTrueFalseTotal
$is_success ? : 77 126 203
21 }
22  
23 sub attr_name {
24 0 ▶ croak '`attr_name` method must be implemented';
Subroutine attr_name: not called CC=1 SCAR=6.9
Pod undocumented
25 }
26  
27 sub is_valid {
28 0 ▶ my ($class, $context, $schema, $data) = @_;
Subroutine is_valid: not called CC=1 SCAR=6.9
Pod undocumented
29 0 croak '`is_valid` method must be implemented';
30 }
31  
32 25 1;
« blib/lib/Valiemon/Attributes/Enum.pm ↑ Summary blib/lib/Valiemon/Attributes/Format.pm »