FieldSpec.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 90.7% 39 / 43 CC 3 SCAR 4.8
CC
3
Cov
94%
clone
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« Types.pm ↑ Summary Util/CallTester.pm »
1 package MOP4Import::FieldSpec; sub FieldSpec () {__PACKAGE__}
2 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 23 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 23 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 23 ▶use Exporter qw/import/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 23 require MOP4Import::Util; # Delay loading
8  
9 BEGIN {
10 23 ▶ our @EXPORT_OK = qw/FieldSpec/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 23 our @EXPORT = @EXPORT_OK;
12 }
13  
14 use fields
15 23 ('name'
16 , 'doc' # documentation
17 , 'default'
18 , 'no_getter'
19 , 'package'
20 , 'json_type'
21 , 'isa'
22 , 'validator'
23 , 'zsh_completer'
24 , 'extra'
25 # file? line? package?
26 23 ▶ );
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub new {
29 332 ▶ my FieldSpec $self = fields::new(shift);
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
30 332 %$self = @_;
31 332 $self;
32 }
33  
34 sub clone {
35 173 ▶ (my FieldSpec $self) = @_;
Subroutine clone: called CC=3 SCAR=11.2
Pod undocumented
36 173 my FieldSpec $clone = fields::new(ref $self);
37 173 foreach my $key (keys %$self) {
38 656 my $val = $self->{$key};
39 656 $clone->{$key} = do {
40 656 ▶ if (ref $val eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val eq 'CODE') { } 0 656 656
41 0 $val
42 } else {
43 656 MOP4Import::Util::shallow_copy($val);
44 }
45 };
46 }
47 173 $clone;
48 }
49  
50 23 1;
« Types.pm ↑ Summary Util/CallTester.pm »