| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ZConf::template; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
29397
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
111
|
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
107
|
|
|
5
|
3
|
|
|
3
|
|
2849
|
use ZConf; |
|
|
3
|
|
|
|
|
355193
|
|
|
|
3
|
|
|
|
|
5041
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
ZConf::template - |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.0.0 |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.0.0'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Quick summary of what the module does. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Perhaps a little code snippet. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use ZConf::template; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $foo = ZConf::template->new(); |
|
28
|
|
|
|
|
|
|
... |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This initializes it. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
One arguement is taken and that is a hash. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head3 hash values |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head4 zconf |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
If this is defined, it will be used instead of creating |
|
43
|
|
|
|
|
|
|
a new ZConf object. |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $foo=ZConf::template->new; |
|
46
|
|
|
|
|
|
|
if($foo->error){ |
|
47
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new{ |
|
53
|
0
|
|
|
0
|
1
|
|
my %args; |
|
54
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
55
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
|
|
|
|
|
my $method='new'; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $self={error=>undef, |
|
60
|
|
|
|
|
|
|
perror=>undef, |
|
61
|
|
|
|
|
|
|
errorString=>undef, |
|
62
|
|
|
|
|
|
|
zconfconfig=>'%%%ZCONFCONFIG%%%', |
|
63
|
|
|
|
|
|
|
module=>'ZConf-template', |
|
64
|
|
|
|
|
|
|
}; |
|
65
|
0
|
|
|
|
|
|
bless $self; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#get the ZConf object |
|
68
|
0
|
0
|
|
|
|
|
if (!defined($args{zconf})) { |
|
69
|
|
|
|
|
|
|
#creates the ZConf object |
|
70
|
0
|
|
|
|
|
|
$self->{zconf}=ZConf->new(); |
|
71
|
0
|
0
|
|
|
|
|
if(defined($self->{zconf}->{error})){ |
|
72
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
73
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
74
|
0
|
|
|
|
|
|
$self->{errorString}="Could not initiate ZConf. It failed with '" |
|
75
|
|
|
|
|
|
|
.$self->{zconf}->{error}."', '". |
|
76
|
|
|
|
|
|
|
$self->{zconf}->{errorString}."'"; |
|
77
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
78
|
0
|
|
|
|
|
|
return $self; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
}else { |
|
81
|
0
|
|
|
|
|
|
$self->{zconf}=$args{zconf}; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
#check if the config exists |
|
85
|
0
|
|
|
|
|
|
my $returned = $self->{zconf}->configExists($self->{zconfconfig}); |
|
86
|
0
|
0
|
|
|
|
|
if (!$self->{zconf}->{error}) { |
|
87
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
88
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
89
|
0
|
|
|
|
|
|
$self->{errorString}="Checking if '".$self."' exists failed. error='". |
|
90
|
|
|
|
|
|
|
$self->{zconf}->{error}."', errorString='". |
|
91
|
|
|
|
|
|
|
$self->{zconf}->{errorString}."'"; |
|
92
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
93
|
0
|
|
|
|
|
|
return $self; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#initiate the config if it does not exist |
|
97
|
0
|
0
|
|
|
|
|
if (!$returned) { |
|
98
|
|
|
|
|
|
|
#create the config |
|
99
|
0
|
|
|
|
|
|
$self->{zconf}->createConfig($self->{zconfconfig}); |
|
100
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
101
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
102
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
103
|
0
|
|
|
|
|
|
$self->{errorString}="Checking if '".$self."' exists failed. error='". |
|
104
|
|
|
|
|
|
|
$self->{zconf}->{error}."', errorString='". |
|
105
|
|
|
|
|
|
|
$self->{zconf}->{errorString}."'"; |
|
106
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
107
|
0
|
|
|
|
|
|
return $self; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#init it |
|
111
|
0
|
|
|
|
|
|
$self->init; |
|
112
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
113
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
114
|
0
|
|
|
|
|
|
$self->{errorString}='Init failed.'; |
|
115
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
116
|
0
|
|
|
|
|
|
return $self; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
}else { |
|
119
|
|
|
|
|
|
|
#if we have a set, make sure we also have a set that will be loaded |
|
120
|
0
|
|
|
|
|
|
$returned=$self->{zconf}->defaultSetExists($self->{zconfconfig}); |
|
121
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
122
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
123
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
124
|
0
|
|
|
|
|
|
$self->{errorString}="Checking if '".$self."' exists failed. error='". |
|
125
|
|
|
|
|
|
|
$self->{zconf}->{error}."', errorString='". |
|
126
|
|
|
|
|
|
|
$self->{zconf}->{errorString}."'"; |
|
127
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
128
|
0
|
|
|
|
|
|
return $self; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#initiliaze a the default set if needed. |
|
132
|
0
|
0
|
|
|
|
|
if (!$returned) { |
|
133
|
|
|
|
|
|
|
#init it |
|
134
|
0
|
|
|
|
|
|
$self->init; |
|
135
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
136
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
137
|
0
|
|
|
|
|
|
$self->{errorString}='Init failed.'; |
|
138
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
139
|
0
|
|
|
|
|
|
return $self; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
} |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
#read the config |
|
146
|
0
|
|
|
|
|
|
$self->{zconf}->read({config=>$self->{zconfconfig}}); |
|
147
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
148
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
149
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
150
|
0
|
|
|
|
|
|
$self->{errorString}="Checking if the default set for '".$self."' exists failed. error='". |
|
151
|
|
|
|
|
|
|
$self->{zconf}->{error}."', errorString='". |
|
152
|
|
|
|
|
|
|
$self->{zconf}->{errorString}."'"; |
|
153
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
154
|
0
|
|
|
|
|
|
return $self; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
return $self; |
|
158
|
|
|
|
|
|
|
} |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 delSet |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This removes the specified ZConf set. |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
$foo->delSet('someSet'); |
|
165
|
|
|
|
|
|
|
if($foo->{error}){ |
|
166
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub delSet{ |
|
172
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
173
|
0
|
|
|
|
|
|
my $set=$_[1]; |
|
174
|
0
|
|
|
|
|
|
my $method='init'; |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
$self->errorblank; |
|
177
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
|
178
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
|
179
|
0
|
|
|
|
|
|
return undef; |
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
$self->{zconf}->delSet($self->{zconfconfg}, $set); |
|
183
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
184
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
185
|
0
|
|
|
|
|
|
$self->{errorString}='ZConf getAvailableSets failed. error="'. |
|
186
|
|
|
|
|
|
|
$self->{zconf}->{error}.'", errorString="'. |
|
187
|
|
|
|
|
|
|
$self->{zconf}->{errorString}.'"'; |
|
188
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
189
|
0
|
|
|
|
|
|
return $self; |
|
190
|
|
|
|
|
|
|
} |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
return 1; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head2 getZConf |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
This returns the ZConf object. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
The only time this will error is if a permanent error is set. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
my $zconf=$foo->getZConf; |
|
203
|
|
|
|
|
|
|
if ($foo->error){ |
|
204
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub getZConf{ |
|
210
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
211
|
0
|
|
|
|
|
|
my $method='getZConf'; |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
$self->errorblank; |
|
214
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
|
215
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
|
216
|
0
|
|
|
|
|
|
return undef; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
return $self->{zconf}; |
|
220
|
|
|
|
|
|
|
} |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 init |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This initiates a new set. If a set already exists, it will be overwritten. |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
If the set specified is undefined, the default will be used. |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
The set is not automatically read. |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
$foo->init($set); |
|
231
|
|
|
|
|
|
|
if($foo->{error}){ |
|
232
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |
|
236
|
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub init{ |
|
238
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
239
|
0
|
|
|
|
|
|
my $set=$_[1]; |
|
240
|
0
|
|
|
|
|
|
my $method='init'; |
|
241
|
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
$self->errorblank; |
|
243
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
|
244
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
|
245
|
0
|
|
|
|
|
|
return undef; |
|
246
|
|
|
|
|
|
|
} |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
#the that what will be used for creating the new ZConf config |
|
249
|
0
|
|
|
|
|
|
my %hash=(); |
|
250
|
|
|
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
$self->{zconf}->writeSetFromHash({config=>$self->{zconfconfig}, set=>$set},\%hash); |
|
252
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
253
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
254
|
0
|
|
|
|
|
|
$self->{errorString}='ZConf writeSetFromHash failed. error="'. |
|
255
|
|
|
|
|
|
|
$self->{zconf}->{error}.'", errorString="'. |
|
256
|
|
|
|
|
|
|
$self->{zconf}->{errorString}.'"'; |
|
257
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
258
|
0
|
|
|
|
|
|
return $self; |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
|
|
261
|
0
|
|
|
|
|
|
return 1; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=head2 listSets |
|
265
|
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
This lists the available sets for the ZConf config. |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
my @sets=$foo->listSets; |
|
269
|
|
|
|
|
|
|
if($foo->{error}){ |
|
270
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=cut |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub listSets{ |
|
276
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
277
|
0
|
|
|
|
|
|
my $method='listSets'; |
|
278
|
|
|
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
$self->errorblank; |
|
280
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
|
281
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
|
282
|
0
|
|
|
|
|
|
return undef; |
|
283
|
|
|
|
|
|
|
} |
|
284
|
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
|
my @sets=$self->{zconf}->getAvailableSets($self->{zconfconfig}); |
|
286
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
287
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
288
|
0
|
|
|
|
|
|
$self->{errorString}='ZConf getAvailableSets failed. error="'. |
|
289
|
|
|
|
|
|
|
$self->{zconf}->{error}.'", errorString="'. |
|
290
|
|
|
|
|
|
|
$self->{zconf}->{errorString}.'"'; |
|
291
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
292
|
0
|
|
|
|
|
|
return $self; |
|
293
|
|
|
|
|
|
|
} |
|
294
|
|
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
|
return @sets; |
|
296
|
|
|
|
|
|
|
} |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
=head2 readSet |
|
299
|
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
This reads a specified ZConf set. |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
If no set is specified, the default is used. |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
$foo->readSet('someSet'); |
|
305
|
|
|
|
|
|
|
if($foo->{error}){ |
|
306
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
|
310
|
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub readSet{ |
|
312
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
313
|
0
|
|
|
|
|
|
my $set=$_[1]; |
|
314
|
0
|
|
|
|
|
|
my $method='readSet'; |
|
315
|
|
|
|
|
|
|
|
|
316
|
0
|
|
|
|
|
|
$self->errorblank; |
|
317
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
|
318
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
|
319
|
0
|
|
|
|
|
|
return undef; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
#read the config |
|
323
|
0
|
|
|
|
|
|
$self->{zconf}->read({config=>$self->{zconfconfig}, set=>$set}); |
|
324
|
0
|
0
|
|
|
|
|
if ($self->{zconf}->{error}) { |
|
325
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
326
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read the set. error="'. |
|
327
|
|
|
|
|
|
|
$self->{zconf}->{error}.'", errorString="'. |
|
328
|
|
|
|
|
|
|
$self->{zconf}->{errorString}.'"'; |
|
329
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
|
330
|
0
|
|
|
|
|
|
return $self; |
|
331
|
|
|
|
|
|
|
} |
|
332
|
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
|
return 1; |
|
334
|
|
|
|
|
|
|
} |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=head1 ERROR RELATED METHODS |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=head2 error |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
This returns the current error code if one is set. If undef/evaulates as false |
|
341
|
|
|
|
|
|
|
then no error is present. Other wise one is. |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
if($foo->error){ |
|
344
|
|
|
|
|
|
|
warn('error '.$foo->error.': '.$foo->errorString); |
|
345
|
|
|
|
|
|
|
} |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=cut |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub error{ |
|
350
|
0
|
|
|
0
|
1
|
|
return $_[0]->{error}; |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=head2 errorString |
|
354
|
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
This returns the current error string. A return of "" means no error is present. |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
my $errorString=$foo->errorString; |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub errorString{ |
|
362
|
0
|
|
|
0
|
1
|
|
return $_[0]->{errorString}; |
|
363
|
|
|
|
|
|
|
} |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=head2 errorblank |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
This blanks the error storage and is only meant for internal usage. |
|
368
|
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
It does the following. |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
$foo->{error}=undef; |
|
372
|
|
|
|
|
|
|
$foo->{errorString}=""; |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
=cut |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
#blanks the error flags |
|
377
|
|
|
|
|
|
|
sub errorblank{ |
|
378
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
379
|
|
|
|
|
|
|
|
|
380
|
0
|
0
|
|
|
|
|
if ($self->{perror}) { |
|
381
|
0
|
|
|
|
|
|
warn('ZConf-DevTemplate errorblank: A permanent error is set'); |
|
382
|
0
|
|
|
|
|
|
return undef; |
|
383
|
|
|
|
|
|
|
} |
|
384
|
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
$self->{error}=undef; |
|
386
|
0
|
|
|
|
|
|
$self->{errorString}=""; |
|
387
|
|
|
|
|
|
|
|
|
388
|
0
|
|
|
|
|
|
return 1; |
|
389
|
|
|
|
|
|
|
} |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
=head2 ERROR CODES |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=head3 1 |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
ZConf errored. |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=head1 AUTHOR |
|
398
|
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
%%%%AUTHOR%%%, C<< <%%%EMAIL%%%> >> |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=head1 BUGS |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
404
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
405
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
406
|
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head1 SUPPORT |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
perldoc ZConf::template |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
You can also look for information at: |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=over 4 |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
L |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
423
|
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
L |
|
425
|
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
427
|
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
L |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
=item * Search CPAN |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
L |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=back |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
Copyright 2009 %%%AUTHOR%%%, all rights reserved. |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
445
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=cut |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
1; # End of ZConf::template |