Natural/Lang/Base.pm

filter: Statementstmt 100% 51 / 51 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 96.9% 64 / 66 CC 4 SCAR 8.5
CC
4
Cov
98%
AUTOLOAD
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« Natural/Wrappers.pm ↑ Summary Natural/Compat.pm »
1 package DateTime::Format::Natural::Lang::Base;
2  
3 27 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 27 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 27 our ($VERSION, $AUTOLOAD);
7  
8 27 $VERSION = '1.09';
9  
10 sub __new
11 10886 ▶{
Subroutine __new: called CC=1 SCAR=0.0
12 10886 my $class = shift;
13  
14 27 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 10886 my $obj = {};
17 10886 $obj->{weekdays} = \%{"${class}::data_weekdays"};
18 10886 $obj->{weekdays_abbrev} = \%{"${class}::data_weekdays_abbrev"};
19 10886 $obj->{weekdays_all} = \@{"${class}::data_weekdays_all"};
20 10886 $obj->{months} = \%{"${class}::data_months"};
21 10886 $obj->{months_abbrev} = \%{"${class}::data_months_abbrev"};
22 10886 $obj->{months_all} = \@{"${class}::data_months_all"};
23 10886 $obj->{conversion} = \%{"${class}::data_conversion"};
24 10886 $obj->{helpers} = \%{"${class}::data_helpers"};
25 10886 $obj->{duration} = \%{"${class}::data_duration"};
26 10886 $obj->{aliases} = \%{"${class}::data_aliases"};
27 10886 $obj->{rewrite} = \%{"${class}::data_rewrite"};
28 10886 $obj->{holidays} = \%{"${class}::data_holidays"};
29  
30 10886 return bless $obj, $class;
31 }
32  
33 AUTOLOAD
34 1879752 ▶{
Subroutine AUTOLOAD: called CC=4 SCAR=13.9
35 1879752 my ($self, $exp) = @_;
36  
37 1879752 my ($caller, $sub) = $AUTOLOAD =~ /^(.+)::(.+)$/;
38  
39 1879752 ▶ if (substr($sub, 0, 2) eq '__') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($sub, 0, 2) eq "__") 1868866 10886 1879752
40 1868866 $sub =~ s/^__//;
41 27 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1868866 ▶ if (defined $exp && length $exp) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $exp and length $exp) { } 1857960 10906 1868866
Condition66%2/3
defined $exp and length $exp
!ll&&!rl&&r
0109061857960
MC/DC50%1/2
defined $exp and length $exp
defined $exp length $exp
Truth table66%2/3
A and B
A= defined $expB= length $exp
ABresult
0X0
100
111
43 1857960 return ${$caller.'::'.$sub}{$exp};
44 }
45 else {
46 10906 return \%{$caller.'::'.$sub};
47 }
48 }
49 }
50  
51 27 1;
52 __END__
« Natural/Wrappers.pm ↑ Summary Natural/Compat.pm »