Class/Fields.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 97.7% 43 / 44 CC 5 SCAR 10.4
CC
5
Cov
100%
add
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« Class/Collection.pm ↑ Summary Class/Field.pm »
1 # ABSTRACT: Container Class for Validation::Class::Field Objects
2  
3 package Validation::Class::Fields;
4 {
5 56 $Validation::Class::Fields::VERSION = '7.10_01';
6 }
7  
8 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 56 our $VERSION = '7.10_01'; # VERSION
12  
13 56 ▶use Carp 'confess';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 56 ▶use base 'Validation::Class::Collection';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 56 ▶use Validation::Class::Field;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 sub add {
21
22 151 ▶ my $self = shift;
Subroutine add: called CC=5 SCAR=16.1
Pod documented
23
24 151 ▶ my %arguments = @_ % 2 ? %{$_[0]} : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ % 2 ? : 45 106 151
25
26 151 ▶ while (my($key, $object) = each %arguments) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %arguments) 172 151 323
27
28 $object->{name} = $key
29 172 ▶ unless defined $object->{name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $object->{"name"} 55 117 172
30
31 172 ▶ $object = Validation::Class::Field->new($object)
Branch: 1 branch
BranchTrueFalseTotal
unless "Validation::Class::Field" eq ref $object 161 11 172
32 unless "Validation::Class::Field" eq ref $object;
33
34 172 $self->{$key} = $object;
35
36 }
37
38 151 return $self;
39
40 }
41  
42 ▶sub clear {
Subroutine clear: not called CC=1 SCAR=0.0
Pod documented
43
44 #noop - fields can't be deleted this way
45
46 }
47  
48 56 1;
49 __END__
« Class/Collection.pm ↑ Summary Class/Field.pm »