line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Su::Procs::ResourceProc; |
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
6
|
use Su::Template; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
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
|
|
|
|
|
|
|
my $model = {}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item new() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Constructor. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
1
|
|
|
1
|
1
|
5
|
return bless { model => $model }, shift; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item process() |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The main method for this process class. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub process { |
46
|
1
|
50
|
33
|
1
|
1
|
9
|
my $self = shift if ( $_[0] && ref $_[0] eq __PACKAGE__ ); |
47
|
1
|
50
|
33
|
|
|
8
|
my $self_module_name = shift if ( $_[0] && $_[0] eq __PACKAGE__ ); |
48
|
1
|
50
|
|
|
|
2
|
my $model = keys %{ $self->{model} } ? $self->{model} : $model; |
|
1
|
|
|
|
|
6
|
|
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
68
|
my $param = shift; |
51
|
1
|
|
|
|
|
5
|
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
|
|
|
|
|
|
|
sub map_filter { |
61
|
0
|
0
|
|
0
|
1
|
0
|
my $self = shift if ref $_[0] eq __PACKAGE__; |
62
|
0
|
|
|
|
|
0
|
my @results = @_; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
0
|
for (@results) { |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
sub reduce_filter { |
78
|
0
|
0
|
|
0
|
1
|
0
|
my $self = shift if ref $_[0] eq __PACKAGE__; |
79
|
0
|
|
|
|
|
0
|
my @results = @_; |
80
|
0
|
|
|
|
|
0
|
my $result; |
81
|
0
|
|
|
|
|
0
|
for (@results) { |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
sub scalar_filter { |
95
|
0
|
0
|
|
0
|
1
|
0
|
my $self = shift if ref $_[0] eq __PACKAGE__; |
96
|
0
|
|
|
|
|
0
|
my $result = shift; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
return $result; |
99
|
|
|
|
|
|
|
} ## end sub scalar_filter |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item model() |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The accessor to the model. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub model { |
108
|
1
|
50
|
|
1
|
1
|
6
|
my $self = shift if ref $_[0] eq __PACKAGE__; |
109
|
1
|
50
|
|
|
|
5
|
my $self_module_name = shift if $_[0] eq __PACKAGE__; |
110
|
1
|
|
|
|
|
2
|
my $arg = shift; |
111
|
1
|
50
|
|
|
|
3
|
if ($arg) { |
112
|
1
|
50
|
|
|
|
6
|
if ($self) { $self->{model} = $arg; } |
|
1
|
|
|
|
|
6
|
|
113
|
|
|
|
|
|
|
else { |
114
|
0
|
|
|
|
|
|
$model = $arg; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} else { |
117
|
0
|
0
|
|
|
|
|
if ($self) { |
118
|
0
|
|
|
|
|
|
return $self->{model}; |
119
|
|
|
|
|
|
|
} else { |
120
|
0
|
|
|
|
|
|
return $model; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} ## end else [ if ($arg) ] |
123
|
|
|
|
|
|
|
} ## end sub model |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |