| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Toader::Render::AutoDoc; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20390
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Error::Helper'; |
|
|
1
|
|
|
|
|
8
|
|
|
|
1
|
|
|
|
|
751
|
|
|
6
|
1
|
|
|
1
|
|
2140
|
use Toader::Render::General; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
39
|
|
|
7
|
1
|
|
|
1
|
|
16
|
use Toader::Templates; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
20
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use Date::Parse; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
153
|
|
|
9
|
1
|
|
|
1
|
|
696
|
use Toader::Render::AutoDoc::Cleanup; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
24
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Toader::pathHelper; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
19
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use File::Path qw(make_path); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
43
|
|
|
12
|
1
|
|
|
1
|
|
1140
|
use Pod::Simple::HTML; |
|
|
1
|
|
|
|
|
59029
|
|
|
|
1
|
|
|
|
|
43
|
|
|
13
|
1
|
|
|
1
|
|
1086
|
use File::Copy; |
|
|
1
|
|
|
|
|
2731
|
|
|
|
1
|
|
|
|
|
118
|
|
|
14
|
1
|
|
|
1
|
|
10
|
use Script::isAperlScript; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2248
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Toader::Render::AutoDoc - This renders a Toader::AutoDoc object. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 VERSION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Version 0.2.1 |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.2.1'; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This initiates the object. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head3 args hash ref |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head4 obj |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This is the L object to render. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head4 toader |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This is the L object to use. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 toDir |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This is the value used to get from the directory it is being |
|
49
|
|
|
|
|
|
|
rendered in back to directory storing stuff for that directory. By |
|
50
|
|
|
|
|
|
|
default this is '../'. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $foo=Toader::Render::AutoDoc->new(\%args); |
|
53
|
|
|
|
|
|
|
if($foo->error){ |
|
54
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new{ |
|
60
|
0
|
|
|
0
|
1
|
|
my %args; |
|
61
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
62
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
}; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $self={ |
|
66
|
|
|
|
|
|
|
error=>undef, |
|
67
|
|
|
|
|
|
|
errorString=>'', |
|
68
|
|
|
|
|
|
|
perror=>undef, |
|
69
|
|
|
|
|
|
|
toDir=>'../', |
|
70
|
|
|
|
|
|
|
errorExtra=>{ |
|
71
|
|
|
|
|
|
|
flags=>{ |
|
72
|
|
|
|
|
|
|
1=>'noObj', |
|
73
|
|
|
|
|
|
|
2=>'noToaderObj', |
|
74
|
|
|
|
|
|
|
3=>'objPerror', |
|
75
|
|
|
|
|
|
|
4=>'toaderObjPerror', |
|
76
|
|
|
|
|
|
|
5=>'noDirSet', |
|
77
|
|
|
|
|
|
|
6=>'cleanupNewErrored', |
|
78
|
|
|
|
|
|
|
7=>'cleanupErrored', |
|
79
|
|
|
|
|
|
|
8=>'fileListFailed', |
|
80
|
|
|
|
|
|
|
9=>'pathhelperNewErrored', |
|
81
|
|
|
|
|
|
|
11=>'noOutputDirSet', |
|
82
|
|
|
|
|
|
|
12=>'outputDirDoesNotExist', |
|
83
|
|
|
|
|
|
|
13=>'outputPageDirCreationFailed', |
|
84
|
|
|
|
|
|
|
14=>'outputFileDirCreationFailed', |
|
85
|
|
|
|
|
|
|
15=>'makePathFailed', |
|
86
|
|
|
|
|
|
|
16=>'copyFailed', |
|
87
|
|
|
|
|
|
|
}, |
|
88
|
|
|
|
|
|
|
}, |
|
89
|
|
|
|
|
|
|
}; |
|
90
|
0
|
|
|
|
|
|
bless $self; |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
if ( defined( $args{toDir} ) ){ |
|
93
|
0
|
|
|
|
|
|
$self->{toDir}=$args{toDir}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#make sure we have a Toader::AutoDoc object. |
|
97
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{obj} ) ){ |
|
98
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
99
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
100
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader::AutoDoc object'; |
|
101
|
0
|
|
|
|
|
|
$self->warn; |
|
102
|
0
|
|
|
|
|
|
return $self; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
0
|
0
|
|
|
|
|
if ( ref( $args{obj} ) ne 'Toader::AutoDoc' ){ |
|
105
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
106
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
107
|
0
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader::AutoDoc object, but a "'. |
|
108
|
|
|
|
|
|
|
ref( $args{obj} ).'"'; |
|
109
|
0
|
|
|
|
|
|
$self->warn; |
|
110
|
0
|
|
|
|
|
|
return $self; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
0
|
|
|
|
|
|
$self->{obj}=$args{obj}; |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#make sure the object does not have a permanent error set |
|
115
|
0
|
0
|
|
|
|
|
if( ! $self->{obj}->errorblank ){ |
|
116
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
117
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
118
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::AutoDoc object has a permanent error set'; |
|
119
|
0
|
|
|
|
|
|
$self->warn; |
|
120
|
0
|
|
|
|
|
|
return $self; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
#make sure a Toader object is given |
|
124
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{toader} ) ){ |
|
125
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
126
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
127
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader object'; |
|
128
|
0
|
|
|
|
|
|
$self->warn; |
|
129
|
0
|
|
|
|
|
|
return $self; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
0
|
0
|
|
|
|
|
if ( ref( $args{toader} ) ne 'Toader' ){ |
|
132
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
133
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
134
|
0
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader object, but a "'. |
|
135
|
|
|
|
|
|
|
ref( $args{toader} ).'"'; |
|
136
|
0
|
|
|
|
|
|
$self->warn; |
|
137
|
0
|
|
|
|
|
|
return $self; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
0
|
|
|
|
|
|
$self->{toader}=$args{toader}; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
#make sure the object does not have a permanent error set |
|
142
|
0
|
0
|
|
|
|
|
if( ! $self->{toader}->errorblank ){ |
|
143
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
144
|
0
|
|
|
|
|
|
$self->{error}=4; |
|
145
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader object has a permanent error set'; |
|
146
|
0
|
|
|
|
|
|
$self->warn; |
|
147
|
0
|
|
|
|
|
|
return $self; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#make sure a directory is set |
|
151
|
0
|
0
|
|
|
|
|
if( ! defined( $self->{obj}->dirGet ) ){ |
|
152
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
153
|
0
|
|
|
|
|
|
$self->{error}=5; |
|
154
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::AutoDoc object does not have a directory set'; |
|
155
|
0
|
|
|
|
|
|
$self->warn; |
|
156
|
0
|
|
|
|
|
|
return $self; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
0
|
|
|
|
|
|
$self->{dir}=$self->{obj}->dirGet; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
#initialize this here for simplicity |
|
161
|
0
|
|
|
|
|
|
$self->{t}=Toader::Templates->new({ |
|
162
|
|
|
|
|
|
|
dir=>$self->{obj}->dirGet, |
|
163
|
|
|
|
|
|
|
toader=>$args{toader}, |
|
164
|
|
|
|
|
|
|
}); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
#initialize the general object here for simplicity |
|
167
|
0
|
|
|
|
|
|
$self->{g}=Toader::Render::General->new( |
|
168
|
|
|
|
|
|
|
{ |
|
169
|
|
|
|
|
|
|
toader=>$self->{toader}, |
|
170
|
|
|
|
|
|
|
self=>\$self, |
|
171
|
|
|
|
|
|
|
obj=>$self->{obj}, |
|
172
|
|
|
|
|
|
|
toDir=>$self->{toDir}, |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
); |
|
175
|
0
|
0
|
|
|
|
|
if ( $self->{g}->error ){ |
|
176
|
0
|
|
|
|
|
|
$self->{perror}=''; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
#initialize the Toader::pathHelper |
|
180
|
0
|
|
|
|
|
|
$self->{ph}=Toader::pathHelper->new( $self->{dir} ); |
|
181
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
|
182
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
183
|
0
|
|
|
|
|
|
$self->{error}=6; |
|
184
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate pathHelper. error="'. |
|
185
|
|
|
|
|
|
|
$self->{ph}->error.'" errorString="'.$self->{ph}->errorString.'"'; |
|
186
|
0
|
|
|
|
|
|
$self->warn; |
|
187
|
0
|
|
|
|
|
|
return $self; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
#gets the r2r for the object |
|
191
|
0
|
|
|
|
|
|
$self->{r2r}=$self->{ph}->relative2root( $self->{dir} ); |
|
192
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
|
193
|
0
|
|
|
|
|
|
$self->{perror}=1; |
|
194
|
0
|
|
|
|
|
|
$self->{error}=19; |
|
195
|
0
|
|
|
|
|
|
$self->{errorString}='pathHelper failed to find the relative2root path for "'. |
|
196
|
|
|
|
|
|
|
$self->{odir}.'"'; |
|
197
|
0
|
|
|
|
|
|
$self->warn; |
|
198
|
0
|
|
|
|
|
|
return $self; |
|
199
|
|
|
|
|
|
|
} |
|
200
|
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
return $self; |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 content |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This renders the content to be included in a static page. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
my $content=$foo->content; |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub content{ |
|
213
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
214
|
|
|
|
|
|
|
|
|
215
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
|
216
|
0
|
|
|
|
|
|
return undef; |
|
217
|
|
|
|
|
|
|
} |
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
my $content=$self->{t}->fill_in( 'autodocContent', |
|
220
|
|
|
|
|
|
|
{ |
|
221
|
|
|
|
|
|
|
g=>\$self->{g}, |
|
222
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
|
223
|
|
|
|
|
|
|
self=>\$self, |
|
224
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
|
225
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
|
226
|
|
|
|
|
|
|
}); |
|
227
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
|
228
|
0
|
|
|
|
|
|
$self->{error}=8; |
|
229
|
0
|
|
|
|
|
|
$self->{errorString}='Filling in the template failed. error="'. |
|
230
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
|
231
|
0
|
|
|
|
|
|
$self->warn; |
|
232
|
0
|
|
|
|
|
|
return undef; |
|
233
|
|
|
|
|
|
|
} |
|
234
|
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
|
return $content; |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head2 render |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
This renders the object. |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
No arguments are taken. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=cut |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub render{ |
|
247
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
248
|
|
|
|
|
|
|
|
|
249
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
|
250
|
0
|
|
|
|
|
|
return undef; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
#makes sure we have a output directory set... |
|
254
|
|
|
|
|
|
|
#while we don't care about this for rendering the content, we do need to |
|
255
|
|
|
|
|
|
|
#know this for actually fully rendering it |
|
256
|
0
|
|
|
|
|
|
my $output=$self->{toader}->getOutputDir; |
|
257
|
0
|
0
|
|
|
|
|
if ( ! defined( $output ) ){ |
|
258
|
0
|
|
|
|
|
|
$self->{error}=11; |
|
259
|
0
|
|
|
|
|
|
$self->{errorString}='No output directory has been set for the Toader object'; |
|
260
|
0
|
|
|
|
|
|
$self->warn; |
|
261
|
0
|
|
|
|
|
|
return undef; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
#makes sure the output directory exists |
|
265
|
0
|
0
|
|
|
|
|
if ( ! -d $output ){ |
|
266
|
0
|
|
|
|
|
|
$self->{error}=12; |
|
267
|
0
|
|
|
|
|
|
$self->{errorString}='The output directory, "'.$output.'", does not exist'; |
|
268
|
0
|
|
|
|
|
|
$self->warn; |
|
269
|
0
|
|
|
|
|
|
return undef; |
|
270
|
|
|
|
|
|
|
} |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
#clean up the old page |
|
273
|
0
|
|
|
|
|
|
my $cleanup=Toader::Render::AutoDoc::Cleanup->new( $self->{toader} ); |
|
274
|
0
|
0
|
|
|
|
|
if ( $cleanup->error ){ |
|
275
|
0
|
|
|
|
|
|
$self->{error}=6; |
|
276
|
0
|
|
|
|
|
|
$self->{errorString}='Initialing the cleanup module failed. error="'. |
|
277
|
|
|
|
|
|
|
$cleanup->error.'" errorString="'.$cleanup->errorString.'"'; |
|
278
|
0
|
|
|
|
|
|
$self->warn; |
|
279
|
0
|
|
|
|
|
|
return undef; |
|
280
|
|
|
|
|
|
|
} |
|
281
|
0
|
|
|
|
|
|
$cleanup->cleanup( $self->{obj} ); |
|
282
|
0
|
0
|
|
|
|
|
if ( $cleanup->error ){ |
|
283
|
0
|
|
|
|
|
|
$self->{error}=7; |
|
284
|
0
|
|
|
|
|
|
$self->{errorString}='Cleanup failed. error="'.$cleanup->error. |
|
285
|
|
|
|
|
|
|
'" errorString="'.$cleanup->errorString.'"'; |
|
286
|
0
|
|
|
|
|
|
$self->warn; |
|
287
|
0
|
|
|
|
|
|
return undef; |
|
288
|
|
|
|
|
|
|
} |
|
289
|
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
#this renders the content of it |
|
291
|
0
|
|
|
|
|
|
my $content=$self->content; |
|
292
|
0
|
0
|
|
|
|
|
if ( $self->error ){ |
|
293
|
0
|
|
|
|
|
|
$self->warnString('Failed to render the content to include'); |
|
294
|
0
|
|
|
|
|
|
return undef; |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
my $page=$self->{t}->fill_in( 'page', |
|
298
|
|
|
|
|
|
|
{ |
|
299
|
|
|
|
|
|
|
toader=>\$self->{toader}, |
|
300
|
|
|
|
|
|
|
g=>\$self->{g}, |
|
301
|
|
|
|
|
|
|
self=>\$self, |
|
302
|
|
|
|
|
|
|
obj=>\$self->{obj}, |
|
303
|
|
|
|
|
|
|
c=>\$self->{toader}->getConfig, |
|
304
|
|
|
|
|
|
|
content=>$content, |
|
305
|
|
|
|
|
|
|
}); |
|
306
|
0
|
0
|
|
|
|
|
if ( $self->{t}->error ){ |
|
307
|
0
|
|
|
|
|
|
$self->{error}=8; |
|
308
|
0
|
|
|
|
|
|
$self->{errorString}='Filling in the template failed. error="'. |
|
309
|
|
|
|
|
|
|
$self->{t}->error.'" errorString="'.$self->{t}->errorString.'"'; |
|
310
|
0
|
|
|
|
|
|
$self->warn; |
|
311
|
0
|
|
|
|
|
|
return undef; |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
#put together some paths for later use |
|
315
|
0
|
|
|
|
|
|
my $autodocDir=$output.'/'.$self->{r2r}.'/.autodoc/'; |
|
316
|
0
|
|
|
|
|
|
my $index=$autodocDir.'/index.html'; |
|
317
|
0
|
|
|
|
|
|
my $filesDir=$autodocDir.'/.files'; |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
#make sure the files and entry directory exist |
|
320
|
0
|
0
|
|
|
|
|
if ( ! -d $autodocDir ){ |
|
321
|
0
|
0
|
|
|
|
|
if ( ! make_path( $autodocDir ) ){ |
|
322
|
0
|
|
|
|
|
|
$self->{error}=13; |
|
323
|
0
|
|
|
|
|
|
$self->{errorString}='The output entry directry, "'.$autodocDir.'", could not be created'; |
|
324
|
0
|
|
|
|
|
|
$self->warn; |
|
325
|
0
|
|
|
|
|
|
return undef; |
|
326
|
|
|
|
|
|
|
} |
|
327
|
|
|
|
|
|
|
} |
|
328
|
0
|
0
|
|
|
|
|
if ( ! -d $filesDir ){ |
|
329
|
0
|
0
|
|
|
|
|
if ( ! make_path( $filesDir ) ){ |
|
330
|
0
|
|
|
|
|
|
$self->{error}=14; |
|
331
|
0
|
|
|
|
|
|
$self->{errorString}='The output file directry, "'.$filesDir.'", could not be created'; |
|
332
|
0
|
|
|
|
|
|
$self->warn; |
|
333
|
0
|
|
|
|
|
|
return undef; |
|
334
|
|
|
|
|
|
|
} |
|
335
|
|
|
|
|
|
|
} |
|
336
|
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
#write the index out |
|
338
|
0
|
|
|
|
|
|
my $fh; |
|
339
|
0
|
0
|
|
|
|
|
if ( ! open( $fh, '>', $index ) ){ |
|
340
|
0
|
|
|
|
|
|
$self->{error}=15; |
|
341
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to open the index, "'.$index.'", for writing'; |
|
342
|
0
|
|
|
|
|
|
$self->warn; |
|
343
|
0
|
|
|
|
|
|
return undef; |
|
344
|
|
|
|
|
|
|
} |
|
345
|
0
|
|
|
|
|
|
print $fh $page; |
|
346
|
0
|
|
|
|
|
|
close( $fh ); |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
#gets a list of documents |
|
349
|
0
|
|
|
|
|
|
my @files=$self->{obj}->findDocs; |
|
350
|
0
|
0
|
|
|
|
|
if ( $self->{obj}->error ){ |
|
351
|
0
|
|
|
|
|
|
$self->{error}=8; |
|
352
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to get a list of the documents'; |
|
353
|
0
|
|
|
|
|
|
$self->warn; |
|
354
|
0
|
|
|
|
|
|
return undef; |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
#copy them all over |
|
358
|
0
|
|
|
|
|
|
my $int=0; |
|
359
|
0
|
|
|
|
|
|
while ( defined( $files[$int] ) ){ |
|
360
|
0
|
|
|
|
|
|
my $copyFrom=$self->{dir}.'/'.$files[$int]; |
|
361
|
0
|
|
|
|
|
|
my $copyTo=$filesDir.'/'.$files[$int]; |
|
362
|
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
#append .html for POD docs |
|
364
|
0
|
|
|
|
|
|
my $ispod=0; |
|
365
|
0
|
|
|
|
|
|
my $checker=Script::isAperlScript->new({ |
|
366
|
|
|
|
|
|
|
any=>1, |
|
367
|
|
|
|
|
|
|
env=>1, |
|
368
|
|
|
|
|
|
|
}); |
|
369
|
0
|
0
|
|
|
|
|
if ( $copyTo =~ /\.[Pp][Oo][Dd]$/ ){ |
|
370
|
0
|
|
|
|
|
|
$ispod='1'; |
|
371
|
|
|
|
|
|
|
} |
|
372
|
0
|
0
|
|
|
|
|
if ( $copyTo =~ /\.[Pp][Mm]$/ ){ |
|
373
|
0
|
|
|
|
|
|
$ispod='1'; |
|
374
|
|
|
|
|
|
|
} |
|
375
|
0
|
0
|
|
|
|
|
if ( $checker->isAperlScript( $copyFrom ) ){ |
|
376
|
0
|
|
|
|
|
|
$ispod='1'; |
|
377
|
|
|
|
|
|
|
} |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
#make sure the directory exists |
|
380
|
0
|
|
|
|
|
|
my $outputdir=$copyTo; |
|
381
|
0
|
|
|
|
|
|
my $outputdirTest=$copyTo; |
|
382
|
0
|
|
|
|
|
|
$outputdirTest=~s/.*\///; |
|
383
|
0
|
|
|
|
|
|
$outputdir=~s/$outputdirTest$//; |
|
384
|
0
|
0
|
|
|
|
|
if ( ! -d $outputdir ){ |
|
385
|
0
|
0
|
|
|
|
|
if ( ! make_path( $outputdir ) ){ |
|
386
|
0
|
|
|
|
|
|
$self->{error}=15; |
|
387
|
0
|
|
|
|
|
|
$self->{errorString}='make_path for "'.$outputdir.'" failed'; |
|
388
|
0
|
|
|
|
|
|
$self->warn; |
|
389
|
0
|
|
|
|
|
|
return undef; |
|
390
|
|
|
|
|
|
|
} |
|
391
|
|
|
|
|
|
|
} |
|
392
|
|
|
|
|
|
|
|
|
393
|
0
|
0
|
|
|
|
|
if ( $ispod ){ |
|
394
|
|
|
|
|
|
|
#handles it if it is a pod |
|
395
|
0
|
|
|
|
|
|
$copyTo=$copyTo.'.html'; |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
#convert to HTML from POD |
|
398
|
0
|
|
|
|
|
|
my $p2h=Pod::Simple::HTML->new; |
|
399
|
0
|
|
|
|
|
|
$p2h->index(1); |
|
400
|
0
|
|
|
|
|
|
my $html; |
|
401
|
0
|
|
|
|
|
|
$p2h->output_string(\$html); |
|
402
|
0
|
|
|
|
|
|
$p2h->parse_file($copyFrom); |
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
#open the $copyTo and write it out |
|
405
|
0
|
|
|
|
|
|
my $fh; |
|
406
|
0
|
0
|
|
|
|
|
if ( ! open( $fh, '>', $copyTo ) ){ |
|
407
|
0
|
|
|
|
|
|
$self->{error}=16; |
|
408
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to open "'.$copyTo.'"'; |
|
409
|
0
|
|
|
|
|
|
$self->warn; |
|
410
|
0
|
|
|
|
|
|
return undef; |
|
411
|
|
|
|
|
|
|
} |
|
412
|
0
|
|
|
|
|
|
print $fh $html; |
|
413
|
0
|
|
|
|
|
|
close( $fh ); |
|
414
|
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
}else{ |
|
416
|
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
#copy it |
|
418
|
0
|
0
|
|
|
|
|
if ( ! copy( $copyFrom, $copyTo ) ){ |
|
419
|
0
|
|
|
|
|
|
$self->{error}=16; |
|
420
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to copy "'.$copyFrom.'" to "'.$copyTo.'"'; |
|
421
|
0
|
|
|
|
|
|
$self->warn; |
|
422
|
0
|
|
|
|
|
|
return undef; |
|
423
|
|
|
|
|
|
|
} |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
} |
|
426
|
|
|
|
|
|
|
|
|
427
|
0
|
|
|
|
|
|
$int++; |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
|
return 1; |
|
432
|
|
|
|
|
|
|
} |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=head2 1, noObj |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
No L object specified. |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=head2 2, noToaderObj |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
No L object specified. |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=head2 3, objPerror |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
The L object has a permanent error set. |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=head2 4, toaderObjPerror |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
The L object has a permanent error set. |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=head2 5, noDirSet |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
The L object does not have a directory set |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=head2 6, cleanupNewErrored |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
Failed to initialize the cleanup module. |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=head2 7, cleanupErrored |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
Failed to cleanup. |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head2 8, fileListFailed |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Failed to get a list of files. |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=head2 9, pathhelperNewErrored |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
Failed to initialize the path helper. |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=head2 11, noOutputDirSet |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
The L object does not have a output directory set. |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=head2 12, outputDirDoesNotExist |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
The output directory does not exist. |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=head2 13, outputPageDirCreationFailed |
|
481
|
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
The output page directory could not be created. |
|
483
|
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=head2 14, outputFileDirCreationFailed |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
The output file directory could not be created. |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=head2 15, makePathFailed |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
make_path failed. |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=head2 16, copyFailed |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
Failed to copy the HTML produced from the POD to where it belongs. |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=head1 AUTHOR |
|
497
|
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
|
499
|
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=head1 BUGS |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
503
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
504
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
505
|
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=head1 SUPPORT |
|
510
|
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
512
|
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
perldoc Toader::Render::AutoDoc |
|
514
|
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
You can also look for information at: |
|
516
|
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=over 4 |
|
518
|
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
520
|
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
L |
|
522
|
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
524
|
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
L |
|
526
|
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
528
|
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
L |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=item * Search CPAN |
|
532
|
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
L |
|
534
|
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=back |
|
536
|
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
542
|
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
Copyright 2013. Zane C. Bowers-Hadley. |
|
544
|
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
546
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
547
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
548
|
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
550
|
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=cut |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
1; # End of Toader::Render::AutoDoc |