line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ZConf::template::GUI; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
23964
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
68
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
5
|
2
|
|
|
2
|
|
1915
|
use ZConf::GUI; |
|
2
|
|
|
|
|
179217
|
|
|
2
|
|
|
|
|
62
|
|
6
|
2
|
|
|
2
|
|
782
|
use ZConf::template; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
3202
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
ZConf::template::GUI - |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.0.0 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.0.0'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Quick summary of what the module does. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Perhaps a little code snippet. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use ZConf::template::GUI; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $foogui = ZConf::template::GUI->new(); |
30
|
|
|
|
|
|
|
... |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 new |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head3 args hash |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head4 obj |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This is object returned by %%%PARENT%%%. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $foogui=ZConf::template::GUI->new({obj=>$obj}); |
43
|
|
|
|
|
|
|
if($foogui->{error}){ |
44
|
|
|
|
|
|
|
print "Error!\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub new{ |
50
|
0
|
|
|
0
|
1
|
|
my %args; |
51
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
52
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
|
my $method='new'; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $self={error=>undef, |
57
|
|
|
|
|
|
|
perror=>undef, |
58
|
|
|
|
|
|
|
errorString=>undef, |
59
|
|
|
|
|
|
|
module=>'ZConf-template-GUI', |
60
|
|
|
|
|
|
|
}; |
61
|
0
|
|
|
|
|
|
bless $self; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#gets the object or initiate it |
64
|
0
|
0
|
|
|
|
|
if (!defined($args{obj})) { |
65
|
0
|
|
|
|
|
|
$self->{obj}=ZConf::template->new; |
66
|
0
|
0
|
|
|
|
|
if ($self->{obj}) { |
67
|
0
|
|
|
|
|
|
$self->{error}=1; |
68
|
0
|
|
|
|
|
|
$self->{perror}=1; |
69
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate %%%PARENT%%%. error="'. |
70
|
|
|
|
|
|
|
$self->{obj}->{error}.'" errorString="'.$self->{obj}->{errorString}.'"'; |
71
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
72
|
0
|
|
|
|
|
|
return $self; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
}else { |
75
|
0
|
|
|
|
|
|
$self->{obj}=$args{obj}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#gets the zconf object |
79
|
0
|
|
|
|
|
|
$self->{zconf}=$self->{obj}->{zconf}; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#gets the gui |
82
|
0
|
|
|
|
|
|
$self->{gui}=ZConf::GUI->new({zconf=>$self->{zconf}}); |
83
|
0
|
0
|
|
|
|
|
if ($self->{obj}) { |
84
|
0
|
|
|
|
|
|
$self->{error}=2; |
85
|
0
|
|
|
|
|
|
$self->{perror}=1; |
86
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate ZConf::GUI. error="'. |
87
|
|
|
|
|
|
|
$self->{gui}->{error}.'" errorString="'.$self->{gui}->{errorString}.'"'; |
88
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
89
|
0
|
|
|
|
|
|
return $self; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->{useX}=$self->{gui}->useX('%%%PARENT%%%'); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my @preferred=$self->{gui}->which('%%%PARENT%%%'); |
95
|
0
|
0
|
|
|
|
|
if ($self->{gui}->{error}) { |
96
|
0
|
|
|
|
|
|
$self->{error}=3; |
97
|
0
|
|
|
|
|
|
$self->{perror}=1; |
98
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get the preferred backend list. error="'. |
99
|
|
|
|
|
|
|
$self->{gui}->{error}.'" errorString="'.$self->{gui}->{errorString}.'"'; |
100
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
101
|
0
|
|
|
|
|
|
return $self; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#make sure we have something |
105
|
0
|
0
|
|
|
|
|
if (!defined($preferred[0])) { |
106
|
0
|
|
|
|
|
|
$self->{error}=6; |
107
|
0
|
|
|
|
|
|
$self->{perror}=1; |
108
|
0
|
|
|
|
|
|
$self->{errorString}='Which did not return any preferred backends'; |
109
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
110
|
0
|
|
|
|
|
|
return $self; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#try the backends till we get one |
114
|
0
|
|
|
|
|
|
my $int=0; |
115
|
0
|
|
|
|
|
|
my $loop=1; |
116
|
0
|
|
|
|
|
|
while ($loop) { |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
if (defined($preferred[0])) { |
120
|
|
|
|
|
|
|
#initiate the backend |
121
|
0
|
|
|
|
|
|
my $toeval='use ZConf::template::GUI::'.$preferred[$int].';'."\n". |
122
|
|
|
|
|
|
|
'$self->{be}=ZConf::template::GUI::'.$preferred[$int]. |
123
|
|
|
|
|
|
|
'->new({zconf=>$self->{zconf}, useX=>$self->{useX},'. |
124
|
|
|
|
|
|
|
'zcgui=>$self->{gui}, zcrunner=>$self->{zcr}}); return 1'; |
125
|
0
|
|
|
|
|
|
my $er=eval($toeval); |
126
|
|
|
|
|
|
|
}else { |
127
|
0
|
|
|
|
|
|
$loop=0; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
#if it returned something, see if it errored |
131
|
0
|
0
|
|
|
|
|
if (defined($self->{be})) { |
132
|
0
|
0
|
|
|
|
|
if (!$self->{be}->{error}) { |
133
|
|
|
|
|
|
|
#stop the loop and continue that we loaded a working one |
134
|
0
|
|
|
|
|
|
$loop=0; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
$int++; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
#failed to initiate the backend |
142
|
0
|
0
|
|
|
|
|
if (!defined($self->{be})) { |
143
|
0
|
|
|
|
|
|
$self->{error}=4; |
144
|
0
|
|
|
|
|
|
$self->{perror}=1; |
145
|
0
|
|
|
|
|
|
$self->{errorString}='The backend returned undefined'; |
146
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
147
|
0
|
|
|
|
|
|
return $self; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#backend errored |
151
|
0
|
0
|
|
|
|
|
if (!$self->{be}->{error}) { |
152
|
0
|
|
|
|
|
|
$self->{error}=4; |
153
|
0
|
|
|
|
|
|
$self->{perror}=1; |
154
|
0
|
|
|
|
|
|
$self->{errorString}='The backend returned undefined. error="'. |
155
|
|
|
|
|
|
|
$self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; |
156
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
157
|
0
|
|
|
|
|
|
return $self; |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
return $self; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 app |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Runs some application. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
$foogui->app; |
168
|
|
|
|
|
|
|
if($foogui->{error}){ |
169
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub app{ |
175
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
176
|
0
|
|
|
|
|
|
my $method='app'; |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
$self->errorblank; |
179
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
180
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
181
|
0
|
|
|
|
|
|
return undef; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
$self->{be}->app; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 hasApp |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
If this returns true, it means it has a application. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
my $hasApp=$foogui->hasApp; |
193
|
|
|
|
|
|
|
if($foogui->{error}){ |
194
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
195
|
|
|
|
|
|
|
}else{ |
196
|
|
|
|
|
|
|
if($hasApp){ |
197
|
|
|
|
|
|
|
print "Yes\n"; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub hasApp{ |
204
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
205
|
0
|
|
|
|
|
|
my $method='hasApp'; |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
$self->errorblank; |
208
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
209
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
210
|
0
|
|
|
|
|
|
return undef; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
my $hasApp=$self->{be}->hasApp; |
214
|
0
|
0
|
|
|
|
|
if ($self->{be}->{error}) { |
215
|
0
|
|
|
|
|
|
$self->{error}=5; |
216
|
0
|
|
|
|
|
|
$self->{errorString}='The backend errored. error="'. |
217
|
|
|
|
|
|
|
$self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; |
218
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
219
|
0
|
|
|
|
|
|
return undef; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
0
|
|
|
|
|
|
return $hasApp; |
223
|
|
|
|
|
|
|
} |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 DIALOG/WINDOW METHODS |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head2 dialogs |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
This returns a array of available dialogs. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
my @dialogs=$foogui->dialogs; |
232
|
|
|
|
|
|
|
if($foogui->{error}){ |
233
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
sub dialogs{ |
239
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
240
|
0
|
|
|
|
|
|
my $method='dialogs'; |
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
|
0
|
|
|
|
|
|
my @dialogs=$self->{be}->dialogs; |
249
|
0
|
0
|
|
|
|
|
if ($self->{be}->{error}) { |
250
|
0
|
|
|
|
|
|
$self->{error}=5; |
251
|
0
|
|
|
|
|
|
$self->{errorString}='The backend errored. error="'. |
252
|
|
|
|
|
|
|
$self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; |
253
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
254
|
0
|
|
|
|
|
|
return undef; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
return @dialogs; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head2 hasDialog |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
This checks if the loaded backend supports a specific dialog. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
my $supported=$foogui->hasDialog($dialogName); |
265
|
|
|
|
|
|
|
if($foogui->error){ |
266
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
if(!supported){ |
269
|
|
|
|
|
|
|
warn($dialogName.' is not supported'); |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=cut |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub hasDialog{ |
275
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
276
|
0
|
|
|
|
|
|
my $dialog=$_[1]; |
277
|
0
|
|
|
|
|
|
my $method='hasDialog'; |
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
|
0
|
|
|
|
|
if (!defined($dialog)) { |
286
|
0
|
|
|
|
|
|
$self->{error}=7; |
287
|
0
|
|
|
|
|
|
$self->{errorString}='No dialog specified'; |
288
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
#try to fetch the supported dialogs |
292
|
0
|
|
|
|
|
|
my @dialogs=$self->dialogs; |
293
|
0
|
0
|
|
|
|
|
if ($self->error) { |
294
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': $self->dialogs errored'); |
295
|
0
|
|
|
|
|
|
return undef; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
#look for a match |
299
|
0
|
|
|
|
|
|
my $int=0; |
300
|
0
|
|
|
|
|
|
while (defined($dialogs[$int])) { |
301
|
|
|
|
|
|
|
#return true if a match is found |
302
|
0
|
0
|
|
|
|
|
if ($dialogs[$int] eq $dialog) { |
303
|
0
|
|
|
|
|
|
return 1; |
304
|
|
|
|
|
|
|
} |
305
|
0
|
|
|
|
|
|
$int++; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
return 0; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=head2 hasWindow |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
This checks if the loaded backend supports a specific window. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
my $supported=$foogui->hasWindow($windowName); |
316
|
|
|
|
|
|
|
if($foogui->error){ |
317
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
if(!supported){ |
320
|
|
|
|
|
|
|
warn($windowName.' is not supported'); |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub hasWindow{ |
326
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
327
|
0
|
|
|
|
|
|
my $dialog=$_[1]; |
328
|
0
|
|
|
|
|
|
my $method='hasDialog'; |
329
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
$self->errorblank; |
331
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
332
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
333
|
0
|
|
|
|
|
|
return undef; |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
0
|
0
|
|
|
|
|
if (!defined($dialog)) { |
337
|
0
|
|
|
|
|
|
$self->{error}=7; |
338
|
0
|
|
|
|
|
|
$self->{errorString}='No dialog specified'; |
339
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
#try to fetch the supported dialogs |
343
|
0
|
|
|
|
|
|
my @dialogs=$self->dialogs; |
344
|
0
|
0
|
|
|
|
|
if ($self->error) { |
345
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': $self->dialogs errored'); |
346
|
0
|
|
|
|
|
|
return undef; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
#look for a match |
350
|
0
|
|
|
|
|
|
my $int=0; |
351
|
0
|
|
|
|
|
|
while (defined($dialogs[$int])) { |
352
|
|
|
|
|
|
|
#return true if a match is found |
353
|
0
|
0
|
|
|
|
|
if ($dialogs[$int] eq $dialog) { |
354
|
0
|
|
|
|
|
|
return 1; |
355
|
|
|
|
|
|
|
} |
356
|
0
|
|
|
|
|
|
$int++; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
0
|
|
|
|
|
|
return 0; |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
=head2 windows |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
This returns a array of available dialogs. |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
my @windows=$foogui->windows; |
367
|
|
|
|
|
|
|
if($foogui->{error}){ |
368
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub windows{ |
374
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
375
|
0
|
|
|
|
|
|
my $method='windows'; |
376
|
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
$self->errorblank; |
378
|
0
|
0
|
|
|
|
|
if ($self->{error}) { |
379
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
380
|
0
|
|
|
|
|
|
return undef; |
381
|
|
|
|
|
|
|
} |
382
|
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
my @windows=$self->{be}->windows; |
384
|
0
|
0
|
|
|
|
|
if ($self->{be}->{error}) { |
385
|
0
|
|
|
|
|
|
$self->{error}=5; |
386
|
0
|
|
|
|
|
|
$self->{errorString}='The backend errored. error="'. |
387
|
|
|
|
|
|
|
$self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; |
388
|
0
|
|
|
|
|
|
warn($self->{module}.' '.$method.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); |
389
|
0
|
|
|
|
|
|
return undef; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
return @windows; |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
=head1 ERROR RELATED METHODS |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
=head2 error |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
This returns the current error code if one is set. If undef/evaulates as false |
400
|
|
|
|
|
|
|
then no error is present. Other wise one is. |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
if($foogui->error){ |
403
|
|
|
|
|
|
|
warn('error '.$foogui->error.': '.$foogui->errorString); |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=cut |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
sub error{ |
409
|
0
|
|
|
0
|
1
|
|
return $_[0]->{error}; |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=head2 errorString |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
This returns the current error string. A return of "" means no error is present. |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
my $errorString=$foogui->errorString; |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=cut |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
sub errorString{ |
421
|
0
|
|
|
0
|
1
|
|
return $_[0]->{errorString}; |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=head2 errorblank |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
This blanks the error storage and is only meant for internal usage. |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
It does the following. |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
$foogui->{error}=undef; |
431
|
|
|
|
|
|
|
$foogui->{errorString}=""; |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=cut |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
#blanks the error flags |
436
|
|
|
|
|
|
|
sub errorblank{ |
437
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
438
|
|
|
|
|
|
|
|
439
|
0
|
0
|
|
|
|
|
if ($self->{perror}) { |
440
|
0
|
|
|
|
|
|
warn('ZConf-DevTemplate errorblank: A permanent error is set'); |
441
|
0
|
|
|
|
|
|
return undef; |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
|
$self->{error}=undef; |
445
|
0
|
|
|
|
|
|
$self->{errorString}=""; |
446
|
|
|
|
|
|
|
|
447
|
0
|
|
|
|
|
|
return 1; |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=head1 ERROR CODES |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=head2 1 |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
Failed to initiate %%%PARENT%%%. |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=head2 2 |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Failed to initiate ZConf::GUI. |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=head2 3 |
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
Failed to get the preferred. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head2 4 |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Failed to initiate the backend. |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=head2 5 |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
Backend errored. |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=head2 6 |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
No backend found via ZConf::GUI->which. |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head2 7 |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
No dialog specified. |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=head1 AUTHOR |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
%%%AUTHOR%%%, C<< <%%%EMAIL%%%> >> |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=head1 BUGS |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
487
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
488
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=head1 SUPPORT |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
perldoc ZConf::template::GUI |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
You can also look for information at: |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=over 4 |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
L |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
L |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=item * CPAN Ratings |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
L |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=item * Search CPAN |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
L |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=back |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
527
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
Copyright 2009 %%%AUTHOR%%%, all rights reserved. |
529
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
531
|
|
|
|
|
|
|
under the same terms as Perl itself. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=cut |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
1; # End of ZConf::template::GUI |