| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Process::Results::Holder; |
|
2
|
1
|
|
|
1
|
|
526
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
149
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# debug tools |
|
5
|
|
|
|
|
|
|
# use Debug::ShowStuff ':all'; |
|
6
|
|
|
|
|
|
|
# use Debug::ShowStuff::ShowVar; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# version |
|
9
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
13
|
|
|
|
|
|
|
# pod |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Process::Results::Holder - methods for objects that hold Process::Results |
|
19
|
|
|
|
|
|
|
objects. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package MyClass; |
|
24
|
|
|
|
|
|
|
use strict; |
|
25
|
|
|
|
|
|
|
use base 'Process::Results::Holder'; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $object = MyClass->new |
|
28
|
|
|
|
|
|
|
my $results = MyClass->results; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$object->error('error-id') |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 OVERVIEW |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
It's often convenient for an object to hold a Process::Results object. |
|
35
|
|
|
|
|
|
|
Process::Results::Holder provides methods for handling a contained results |
|
36
|
|
|
|
|
|
|
object. To add these methods to your class, simply extend |
|
37
|
|
|
|
|
|
|
Process::Results::Holder: |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use base 'Process::Results::Holder'; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The methods that are added to your class assume that you have or will put a |
|
42
|
|
|
|
|
|
|
results object in the 'results' property of the object. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# |
|
49
|
|
|
|
|
|
|
# pod |
|
50
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
55
|
|
|
|
|
|
|
# results |
|
56
|
|
|
|
|
|
|
# |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 results() |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
C returns the Process::Results object that is held by the holder. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$results = $object->results(); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
If the results object exists in the 'results' property: |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$object->{'results'} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
then it is returned. If it does not exist, then one is created, stored in the |
|
69
|
|
|
|
|
|
|
'results' object, then returned. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub results { |
|
74
|
5
|
|
|
5
|
1
|
2416
|
my ($holder, %opts) = @_; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# TESTING |
|
77
|
|
|
|
|
|
|
# println subname(); ##i |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# create object if necessary |
|
80
|
5
|
100
|
|
|
|
13
|
if (! $holder->{'results'}) { |
|
81
|
1
|
|
|
|
|
4
|
$holder->{'results'} = $holder->results_class->new(); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# return |
|
85
|
5
|
|
|
|
|
24
|
return $holder->{'results'}; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
# |
|
88
|
|
|
|
|
|
|
# results |
|
89
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
93
|
|
|
|
|
|
|
# messages |
|
94
|
|
|
|
|
|
|
# |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 error(), warning(), note() |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
These methods do that same thing as their Process::Results counterparts: they |
|
99
|
|
|
|
|
|
|
store messages in the results object. If the results object doesn't exist, it |
|
100
|
|
|
|
|
|
|
is created. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub error { |
|
105
|
1
|
|
|
1
|
1
|
2
|
my $holder = shift; |
|
106
|
1
|
|
|
|
|
3
|
return $holder->results->error(@_); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub warning { |
|
110
|
1
|
|
|
1
|
1
|
2
|
my $holder = shift; |
|
111
|
1
|
|
|
|
|
2
|
return $holder->results->warning(@_); |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub note { |
|
115
|
1
|
|
|
1
|
1
|
2
|
my $holder = shift; |
|
116
|
1
|
|
|
|
|
3
|
return $holder->results->note(@_); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
# |
|
119
|
|
|
|
|
|
|
# messages |
|
120
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
124
|
|
|
|
|
|
|
# results_class |
|
125
|
|
|
|
|
|
|
# |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 results_class() |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This method returns the class name to use to create the results object. By |
|
130
|
|
|
|
|
|
|
default it returns 'Process::Results'. Override this class if you would like |
|
131
|
|
|
|
|
|
|
to use a custom results class. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub results_class { |
|
136
|
1
|
|
|
1
|
1
|
7
|
return 'Process::Results'; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
# |
|
139
|
|
|
|
|
|
|
# results_class |
|
140
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
# return |
|
145
|
|
|
|
|
|
|
1; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
__END__ |