Su/Procs/ResourceProc.pm

filter: Statementstmt 60.0% 24 / 40 Branchbran 31.8% 7 / 22 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 6 / 9 Podpod 100% 6 / 6 totaltotal 51.7% 45 / 87 CC 16 SCAR 21.2
CC
16
Cov
49%
map_filter
12.0
reduce_filter
12.0
model
10.5
CRAP 8.3
« Su/Log.pm ↑ Summary
1 package Su::Procs::ResourceProc;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Su::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =pod
7  
8 =head1 NAME
9  
10 Su::Procs::ResourceProc - The process to load resource strings.
11  
12 =head1 SYNOPSYS
13  
14 my $su = Su->new.
15 my $value = $su->resolve('resource');
16  
17 =head1 DESCRIPTION
18  
19 The process to load resource strings.
20  
21 =head1 FUNCTIONS
22  
23 =over
24  
25 =cut
26  
27 1 my $model = {};
28  
29 =item new()
30  
31 Constructor.
32  
33 =cut
34  
35 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
36 1 return bless { model => $model }, shift;
37 }
38  
39 =item process()
40  
41 The main method for this process class.
42  
43 =cut
44  
45 1 ▶sub process {
Subroutine process: called CC=6 SCAR=20.9
Pod documented
46 1 ▶ my $self = shift if ( $_[0] && ref $_[0] eq __PACKAGE__ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] and ref $_[0] eq __PACKAGE__ 1 0 1
Condition33%1/3
$_[0] and ref $_[0] eq __PACKAGE__
!ll&&!rl&&r
001
MC/DC0%0/2
$_[0] and ref $_[0] eq __PACKAGE__
$_[0] ref $_[0] eq __PACKAGE__
Truth table33%1/3
A and B
A= $_[0]B= ref $_[0] eq __PACKAGE__
ABresult
0X0
100
111
47 1 ▶ my $self_module_name = shift if ( $_[0] && $_[0] eq __PACKAGE__ );
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] and $_[0] eq __PACKAGE__ 0 1 1
Condition33%1/3
$_[0] and $_[0] eq __PACKAGE__
!ll&&!rl&&r
010
MC/DC0%0/2
$_[0] and $_[0] eq __PACKAGE__
$_[0] $_[0] eq __PACKAGE__
Truth table33%1/3
A and B
A= $_[0]B= $_[0] eq __PACKAGE__
ABresult
0X0
100
111
48 1 ▶ my $model = keys %{ $self->{model} } ? $self->{model} : $model;
Branch: 1 branch
BranchTrueFalseTotal
keys %{$$self{'model'};} ? : 1 0 1
49  
50 1 my $param = shift;
51 1 return $model->{$param};
52 } ## end sub process
53  
54 =item map_filter()
55  
56 This method is called if specified as a map filter class.
57  
58 =cut
59  
60 0 ▶sub map_filter {
Subroutine map_filter: not called CC=3 SCAR=24.8
Pod documented
61 0 ▶ my $self = shift if ref $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq __PACKAGE__ 0 0 0
62 0 my @results = @_;
63  
64 0 for (@results) {
65  
66 }
67  
68 0 return @results;
69 } ## end sub map_filter
70  
71 =item reduce_filter()
72  
73 This method is called if specified as a reduce filter class.
74  
75 =cut
76  
77 0 ▶sub reduce_filter {
Subroutine reduce_filter: not called CC=3 SCAR=24.8
Pod documented
78 0 ▶ my $self = shift if ref $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq __PACKAGE__ 0 0 0
79 0 my @results = @_;
80 0 my $result;
81 0 for (@results) {
82  
83 }
84  
85 0 return $result;
86 } ## end sub reduce_filter
87  
88 =item scalar_filter()
89  
90 This method is called if specified as a scalar filter class.
91  
92 =cut
93  
94 0 ▶sub scalar_filter {
Subroutine scalar_filter: not called CC=2 SCAR=17.9
Pod documented
95 0 ▶ my $self = shift if ref $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq __PACKAGE__ 0 0 0
96 0 my $result = shift;
97  
98 0 return $result;
99 } ## end sub scalar_filter
100  
101 =item model()
102  
103 The accessor to the model.
104  
105 =cut
106  
107 1 ▶sub model {
Subroutine model: called CC=6 SCAR=23.5
Pod documented
108 1 ▶ my $self = shift if ref $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] eq __PACKAGE__ 1 0 1
109 1 ▶ my $self_module_name = shift if $_[0] eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if $_[0] eq __PACKAGE__ 0 1 1
110 1 my $arg = shift;
111 1 ▶ if ($arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg) { } 1 0 1
112 1 ▶ if ($self) { $self->{model} = $arg; }
Branch: 1 branch
BranchTrueFalseTotal
if ($self) { } 1 0 1
113 else {
114 0 $model = $arg;
115 }
116 } else {
117 0 ▶ if ($self) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self) { } 0 0 0
118 0 return $self->{model};
119 } else {
120 0 return $model;
121 }
122 } ## end else [ if ($arg) ]
123 } ## end sub model
124  
125 1 1;
126  
127 =back
128  
129 =cut
« Su/Log.pm ↑ Summary