| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Toader::Entry::Helper; |
|
2
|
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
20934
|
use warnings; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
475
|
|
|
4
|
7
|
|
|
7
|
|
40
|
use strict; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
259
|
|
|
5
|
7
|
|
|
7
|
|
1737
|
use Toader::isaToaderDir; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
164
|
|
|
6
|
7
|
|
|
7
|
|
44
|
use base 'Error::Helper'; |
|
|
7
|
|
|
|
|
13
|
|
|
|
7
|
|
|
|
|
493
|
|
|
7
|
7
|
|
|
7
|
|
3645
|
use Toader::pathHelper; |
|
|
7
|
|
|
|
|
22
|
|
|
|
7
|
|
|
|
|
209
|
|
|
8
|
7
|
|
|
7
|
|
3625
|
use Toader::Entry::Manage; |
|
|
7
|
|
|
|
|
23
|
|
|
|
7
|
|
|
|
|
223
|
|
|
9
|
7
|
|
|
7
|
|
18313
|
use Time::HiRes qw( gettimeofday ); |
|
|
7
|
|
|
|
|
13572
|
|
|
|
7
|
|
|
|
|
36
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Toader::Entry::Helper - Misc helper methods for entries. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 1.0.0 |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '1.0.0'; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This initializes this object. |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
On argument is required and it is a L object. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $foo = Toader::Entry::Helper->new; |
|
32
|
|
|
|
|
|
|
if($foo->error){ |
|
33
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new{ |
|
39
|
0
|
|
|
0
|
1
|
|
my $toader=$_[1]; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $self={ |
|
42
|
|
|
|
|
|
|
error=>undef, |
|
43
|
|
|
|
|
|
|
errorString=>'', |
|
44
|
|
|
|
|
|
|
perror=>undef, |
|
45
|
|
|
|
|
|
|
directory=>undef, |
|
46
|
|
|
|
|
|
|
regex=>'[12][90][0123456789][0123456789]'. |
|
47
|
|
|
|
|
|
|
'[01][0123456789]'. |
|
48
|
|
|
|
|
|
|
'[012][0123456789]-'. |
|
49
|
|
|
|
|
|
|
'[012][0123456789]'. |
|
50
|
|
|
|
|
|
|
'[012345][0123456789]'. |
|
51
|
|
|
|
|
|
|
'[012345][0123456789].'. |
|
52
|
|
|
|
|
|
|
'[0123456789]*', |
|
53
|
|
|
|
|
|
|
errorExtra=>{ |
|
54
|
|
|
|
|
|
|
flags=>{ |
|
55
|
|
|
|
|
|
|
1=>'notAtoaderDir', |
|
56
|
|
|
|
|
|
|
2=>'noDirSpecified', |
|
57
|
|
|
|
|
|
|
3=>'noEntrySpecified', |
|
58
|
|
|
|
|
|
|
4=>'noDirSet', |
|
59
|
|
|
|
|
|
|
5=>'invalidEntryName', |
|
60
|
|
|
|
|
|
|
6=>'entryManageErrored', |
|
61
|
|
|
|
|
|
|
7=>'listEntriesErrored', |
|
62
|
|
|
|
|
|
|
8=>'readEntryErrored', |
|
63
|
|
|
|
|
|
|
9=>'noToaderObj', |
|
64
|
|
|
|
|
|
|
10=>'notAtoaderObj', |
|
65
|
|
|
|
|
|
|
}, |
|
66
|
|
|
|
|
|
|
}, |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
0
|
|
|
|
|
|
bless $self; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#if we have a Toader object, reel it in |
|
71
|
0
|
0
|
|
|
|
|
if ( ! defined( $toader ) ){ |
|
72
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
73
|
0
|
|
|
|
|
|
$self->{error}=9; |
|
74
|
0
|
|
|
|
|
|
$self->{errorString}='No Toader object specified'; |
|
75
|
0
|
|
|
|
|
|
$self->warn; |
|
76
|
0
|
|
|
|
|
|
return $self; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
0
|
0
|
|
|
|
|
if ( ref( $toader ) ne "Toader" ){ |
|
79
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
80
|
0
|
|
|
|
|
|
$self->{error}=10; |
|
81
|
0
|
|
|
|
|
|
$self->{errorString}='The object specified is a "'.ref($toader).'"'; |
|
82
|
0
|
|
|
|
|
|
$self->warn; |
|
83
|
0
|
|
|
|
|
|
return $self; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
0
|
|
|
|
|
|
$self->{toader}=$toader; |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return $self; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 entryDirectory |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This returns the entry directory. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This requires setDir to be called previously. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
If setDir has been successfully called, this will not error. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my $entryDirectory=$foo->entryDirectory; |
|
99
|
|
|
|
|
|
|
if($foo->error){ |
|
100
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub entryDirectory{ |
|
106
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#blank any previous errors |
|
109
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
110
|
0
|
|
|
|
|
|
return undef; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#make sure setDir has been called with out issue |
|
114
|
0
|
0
|
|
|
|
|
if (!defined($self->{directory})) { |
|
115
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
116
|
0
|
|
|
|
|
|
$self->{errorString}='No directory has been set yet'; |
|
117
|
0
|
|
|
|
|
|
$self->warn; |
|
118
|
0
|
|
|
|
|
|
return undef; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return $self->{directory}.'/.toader/entries/'; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 entryExists |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This checks if the specified helper exists. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
One argument is accepted and it is |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This requires setDir to be called previously. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $retruned=$foo->entryExists($entry); |
|
133
|
|
|
|
|
|
|
if($foo->error){ |
|
134
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
if($returned){ |
|
137
|
|
|
|
|
|
|
print "It exists.\n"; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=cut |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub entryExists{ |
|
143
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
144
|
0
|
|
|
|
|
|
my $entry=$_[1]; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
#blank any previous errors |
|
147
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
148
|
0
|
|
|
|
|
|
return undef; |
|
149
|
|
|
|
|
|
|
} |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#make sure setDir has been called with out issue |
|
152
|
0
|
0
|
|
|
|
|
if (!defined($self->{directory})) { |
|
153
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
154
|
0
|
|
|
|
|
|
$self->{errorString}='No directory has been set yet'; |
|
155
|
0
|
|
|
|
|
|
$self->warn; |
|
156
|
0
|
|
|
|
|
|
return undef; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
#make sure a entry is specified. |
|
160
|
0
|
0
|
|
|
|
|
if (!defined($entry)) { |
|
161
|
0
|
|
|
|
|
|
$self->{error}=0; |
|
162
|
0
|
|
|
|
|
|
$self->{errorString}='No entry specified'; |
|
163
|
0
|
|
|
|
|
|
$self->warn; |
|
164
|
0
|
|
|
|
|
|
return undef; |
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
#make sure we have a valid entry name. |
|
168
|
0
|
|
|
|
|
|
my $returned=$self->validEntryName($entry); |
|
169
|
0
|
0
|
|
|
|
|
if (!$returned) { |
|
170
|
0
|
|
|
|
|
|
$self->{error}=5; |
|
171
|
0
|
|
|
|
|
|
$self->{errorString}='The entry name is not valid'; |
|
172
|
0
|
|
|
|
|
|
$self->warn; |
|
173
|
0
|
|
|
|
|
|
return undef; |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
#check if it exists |
|
177
|
0
|
0
|
|
|
|
|
if (-f $self->{directory}.'/.toader/entries/'.$entry ) { |
|
178
|
0
|
|
|
|
|
|
return 1; |
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
return 0; |
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 generateEntryName |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This generates a entry name. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
my $entryName=$foo->generateEntryName; |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub generateEntryName{ |
|
193
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
#blank any previous errors |
|
196
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
197
|
0
|
|
|
|
|
|
return undef; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
#gets the time |
|
201
|
0
|
|
|
|
|
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); |
|
202
|
0
|
|
|
|
|
|
$year += 1900; |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
#makes sure there are no single digit time items |
|
205
|
0
|
0
|
|
|
|
|
if ($mon=~/^[0123456789]$/) { |
|
206
|
0
|
|
|
|
|
|
$mon='0'.$mon; |
|
207
|
|
|
|
|
|
|
} |
|
208
|
0
|
0
|
|
|
|
|
if ($mday=~/^[0123456789]$/) { |
|
209
|
0
|
|
|
|
|
|
$mday='0'.$mday; |
|
210
|
|
|
|
|
|
|
} |
|
211
|
0
|
0
|
|
|
|
|
if ($hour=~/^[0123456789]$/) { |
|
212
|
0
|
|
|
|
|
|
$hour='0'.$hour; |
|
213
|
|
|
|
|
|
|
} |
|
214
|
0
|
0
|
|
|
|
|
if ($min=~/^[0123456789]$/) { |
|
215
|
0
|
|
|
|
|
|
$min='0'.$min; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
0
|
0
|
|
|
|
|
if ($sec=~/^[0123456789]$/) { |
|
218
|
0
|
|
|
|
|
|
$sec='0'.$sec; |
|
219
|
|
|
|
|
|
|
} |
|
220
|
0
|
|
|
|
|
|
$mon++; |
|
221
|
0
|
|
|
|
|
|
my $hsec=gettimeofday; |
|
222
|
0
|
|
|
|
|
|
$hsec=~s/.*\.//; |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
#generate it and return it |
|
225
|
0
|
|
|
|
|
|
return $year.$mon.$mday.'-'.$hour.$min.$sec.'.'.$hsec; |
|
226
|
|
|
|
|
|
|
} |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head2 setDir |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This sets the directory to operate on. |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
One argument is required. It is the directory to use. |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
$foo->setDir($directory); |
|
235
|
|
|
|
|
|
|
if($foo->error){ |
|
236
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=cut |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub setDir{ |
|
242
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
243
|
0
|
|
|
|
|
|
my $directory=$_[1]; |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
#blank any previous errors |
|
246
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
247
|
0
|
|
|
|
|
|
return undef; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
#error if no directory is specified |
|
251
|
0
|
0
|
|
|
|
|
if (!defined( $directory )) { |
|
252
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
253
|
0
|
|
|
|
|
|
$self->{errorString}='No directory specified'; |
|
254
|
0
|
|
|
|
|
|
$self->warn; |
|
255
|
0
|
|
|
|
|
|
return undef; |
|
256
|
|
|
|
|
|
|
} |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
#cleans up the naming |
|
259
|
0
|
|
|
|
|
|
my $pathHelper=Toader::pathHelper->new( $directory ); |
|
260
|
0
|
|
|
|
|
|
$directory=$pathHelper->cleanup( $directory ); |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
#make sure it is a Toader directory |
|
263
|
0
|
|
|
|
|
|
my $tdc=Toader::isaToaderDir->new; |
|
264
|
0
|
|
|
|
|
|
my $isaToaderDir=$tdc->isaToaderDir($directory); |
|
265
|
0
|
0
|
|
|
|
|
if ( ! $isaToaderDir ) { |
|
266
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
267
|
0
|
|
|
|
|
|
$self->{errorString}='Not a Toader directory according to Toader::isaToaderDir->isaToaderDir '; |
|
268
|
0
|
|
|
|
|
|
$self->warn; |
|
269
|
0
|
|
|
|
|
|
return undef; |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
#save the directory |
|
273
|
0
|
|
|
|
|
|
$self->{directory}=$directory; |
|
274
|
|
|
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
return 1; |
|
276
|
|
|
|
|
|
|
} |
|
277
|
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head2 summary |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This builds a summary of the of the entries in the directory. |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=head3 returned hash |
|
283
|
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
The key values are the entry IDs. Each subhash then |
|
285
|
|
|
|
|
|
|
contains the following keys. |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
from |
|
288
|
|
|
|
|
|
|
renderer |
|
289
|
|
|
|
|
|
|
title |
|
290
|
|
|
|
|
|
|
summary |
|
291
|
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
=cut |
|
293
|
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub summary{ |
|
295
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
#blank any previous errors |
|
298
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
299
|
0
|
|
|
|
|
|
return undef; |
|
300
|
|
|
|
|
|
|
} |
|
301
|
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
#make sure setDir has been called with out issue |
|
303
|
0
|
0
|
|
|
|
|
if (!defined($self->{directory})) { |
|
304
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
305
|
0
|
|
|
|
|
|
$self->{errorString}='No directory has been set yet'; |
|
306
|
0
|
|
|
|
|
|
$self->warn; |
|
307
|
0
|
|
|
|
|
|
return undef; |
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
#initalize Toader::Entry::Manage |
|
311
|
0
|
|
|
|
|
|
my $emanage=Toader::Entry::Manage->new( $self->{toader} ) ; |
|
312
|
0
|
|
|
|
|
|
$emanage->setDir( $self->{directory} ); |
|
313
|
0
|
0
|
|
|
|
|
if ( $emanage->error ){ |
|
314
|
0
|
|
|
|
|
|
$self->{error}=6; |
|
315
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Entry::Manage. '. |
|
316
|
|
|
|
|
|
|
'error="'.$emanage->error.'" errorString="'.$emanage->errorString.'"'; |
|
317
|
0
|
|
|
|
|
|
$self->warn; |
|
318
|
0
|
|
|
|
|
|
return undef; |
|
319
|
|
|
|
|
|
|
} |
|
320
|
|
|
|
|
|
|
|
|
321
|
0
|
|
|
|
|
|
my @entries=$emanage->list; |
|
322
|
0
|
0
|
|
|
|
|
if ( $emanage->error ){ |
|
323
|
0
|
|
|
|
|
|
$self->{error}=7; |
|
324
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to list the entries. error="' |
|
325
|
|
|
|
|
|
|
.$emanage->error.'" errorString="'.$emanage->errorString.'"'; |
|
326
|
0
|
|
|
|
|
|
$self->warn; |
|
327
|
0
|
|
|
|
|
|
return undef; |
|
328
|
|
|
|
|
|
|
} |
|
329
|
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
my %summary; |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my $int=0; |
|
333
|
0
|
|
|
|
|
|
while( defined( $entries[$int] ) ){ |
|
334
|
0
|
|
|
|
|
|
my $entry=$emanage->read( $entries[$int] ); |
|
335
|
0
|
0
|
|
|
|
|
if( $emanage->error ){ |
|
336
|
0
|
|
|
|
|
|
$self->{error}=8; |
|
337
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to read the entry "'.$entries[$int].'". error="' |
|
338
|
|
|
|
|
|
|
.$emanage->error.'" errorString="'.$emanage->errorString.'"'; |
|
339
|
0
|
|
|
|
|
|
$self->warn; |
|
340
|
0
|
|
|
|
|
|
return undef; |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
0
|
|
|
|
|
|
$summary{$entries[$int]}={ |
|
344
|
|
|
|
|
|
|
from=>$entry->fromGet, |
|
345
|
|
|
|
|
|
|
title=>$entry->titleGet, |
|
346
|
|
|
|
|
|
|
renderer=>$entry->rendererGet, |
|
347
|
|
|
|
|
|
|
summary=>$entry->summaryGet, |
|
348
|
|
|
|
|
|
|
}; |
|
349
|
|
|
|
|
|
|
|
|
350
|
0
|
|
|
|
|
|
$int++; |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
return %summary; |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=head2 validEntryName |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
This verifies that the name is a valid file name. |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
One arguemnet is taken and that is the name of the entry |
|
361
|
|
|
|
|
|
|
name to check. |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
This will not error. If the name is not defined, false, '0', will |
|
364
|
|
|
|
|
|
|
be returned as undefined is not a valid name. |
|
365
|
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
my $valid=$foo->validEntryName($name); |
|
367
|
|
|
|
|
|
|
if($valid){ |
|
368
|
|
|
|
|
|
|
print '"'.$name.'" is a valid name.'; |
|
369
|
|
|
|
|
|
|
} |
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
=cut |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
sub validEntryName{ |
|
374
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
375
|
0
|
|
|
|
|
|
my $name=$_[1]; |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
#blank any previous errors |
|
378
|
0
|
0
|
|
|
|
|
if (!$self->errorblank) { |
|
379
|
0
|
|
|
|
|
|
return undef; |
|
380
|
|
|
|
|
|
|
} |
|
381
|
|
|
|
|
|
|
|
|
382
|
0
|
0
|
|
|
|
|
if (!defined($name)) { |
|
383
|
0
|
|
|
|
|
|
return undef; |
|
384
|
|
|
|
|
|
|
} |
|
385
|
|
|
|
|
|
|
|
|
386
|
0
|
0
|
|
|
|
|
if ($name =~ /$self->{regex}/) { |
|
387
|
0
|
|
|
|
|
|
return 1; |
|
388
|
|
|
|
|
|
|
} |
|
389
|
|
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
|
return 0; |
|
391
|
|
|
|
|
|
|
} |
|
392
|
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=head2 validEntryNameRegex |
|
394
|
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
This returns the regular expression for validating a entry name. |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
This method does not call errorBlank for ease simplicity. This means |
|
398
|
|
|
|
|
|
|
a error check should not be done on this message as if any error was |
|
399
|
|
|
|
|
|
|
set previously then one will still be set. |
|
400
|
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
my $regex=$foo->validEntryNameRegex($name); |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=cut |
|
404
|
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub validEntryNameRegex{ |
|
406
|
0
|
|
|
0
|
1
|
|
return $_[0]->{regex}; |
|
407
|
|
|
|
|
|
|
} |
|
408
|
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=head2 1, notAtoaderDir |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
Not a L directory. |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=head2 2, noDirSpecified |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
No directory specified. |
|
418
|
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
=head2 3, noEntrySpecified |
|
420
|
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
No entry specified. |
|
422
|
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=head2 4, noDirSet |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
No directory has been set yet. |
|
426
|
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=head2 5, invalidEntryName |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
The entry name is not valid. |
|
430
|
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head2 6, entryManageErrored |
|
432
|
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
Failed to initialize L. |
|
434
|
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head2 7, listEntriesErrored |
|
436
|
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
Failed to list the entires. |
|
438
|
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=head2 8, readEntryErrored |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
Failed to read a entry. |
|
442
|
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=head2 9, noToaderObj |
|
444
|
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
No L object specified. |
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=head2 10, notAtoaderObj |
|
448
|
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
The object specified is not a L object. |
|
450
|
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=head1 AUTHOR |
|
452
|
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
|
454
|
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=head1 BUGS |
|
456
|
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
458
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
459
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
460
|
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=head1 SUPPORT |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
464
|
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
perldoc Toader::Entry::Helper |
|
466
|
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
You can also look for information at: |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=over 4 |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
L |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
L |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
L |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=item * Search CPAN |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
L |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=back |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
492
|
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
Copyright 2011 Zane C. Bowers-Hadley. |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
499
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
500
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=cut |
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
1; # End of Toader |