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
« Valiemon/Attributes/Enum.pm ↑ Summary 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 1322 ▶sub attr {
Subroutine attr: called CC=3 SCAR=11.0
Pod undocumented
14 1322 my ($name) = @_;
15 1322 $name =~ s/^\$//; # TODO have package mappings instead of dinamic load
16 1322 my $class = join '::', __PACKAGE__, (ucfirst $name);
17 1322 ▶ return $class if is_class_loaded($class);
Branch: 1 branch
BranchTrueFalseTotal
if is_class_loaded($class) 1116 206 1322
18  
19 206 my ($is_success) = try_load_class($class);
20 204 ▶ return $is_success ? $class : undef;
Branch: 1 branch
BranchTrueFalseTotal
$is_success ? : 77 127 204
21 }
22  
23 0 ▶sub attr_name {
Subroutine attr_name: not called CC=1 SCAR=6.9
Pod undocumented
24 0 croak '`attr_name` method must be implemented';
25 }
26  
27 0 ▶sub is_valid {
Subroutine is_valid: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my ($class, $context, $schema, $data) = @_;
29 0 croak '`is_valid` method must be implemented';
30 }
31  
32 25 1;
« Valiemon/Attributes/Enum.pm ↑ Summary Valiemon/Attributes/Format.pm »