| 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
Condition33%1/3
$_[0] and ref $_[0] eq __PACKAGE__
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__
| |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | my $self_module_name = shift if ( $_[0] && $_[0] eq __PACKAGE__ ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0] and $_[0] eq __PACKAGE__
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__
| |||||||||||||||||||||||||||||
| 48 | 1 | ▶ | my $model = keys %{ $self->{model} } ? $self->{model} : $model; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 109 | 1 | ▶ | my $self_module_name = shift if $_[0] eq __PACKAGE__; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 1 | my $arg = shift; | |||||||||||||||||||||||||||
| 111 | 1 | ▶ | if ($arg) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 1 | ▶ | if ($self) { $self->{model} = $arg; } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | else { | ||||||||||||||||||||||||||||
| 114 | 0 | $model = $arg; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } else { | ||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($self) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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 | ||||||||||||||||||||||||||||