line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader::Render::Directory::backends::html; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21039
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Error::Helper'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
771
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Toader::Render::Directory::backends::html - This handles the html backend stuff for Toader::Render::Directory. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.1.0 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.1.0'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use Toader::Render::Directory::backends::html; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $renderer=Toader::Render::Directory::backends::html->new({ toader=>$oader, obj=>$directoryObj }); |
24
|
|
|
|
|
|
|
my $rendered; |
25
|
|
|
|
|
|
|
if ( $renderer->error ){ |
26
|
|
|
|
|
|
|
warn( 'Error:'.$renderer->error.': '.$renderer->errorString ); |
27
|
|
|
|
|
|
|
}else{ |
28
|
|
|
|
|
|
|
$rendered=$renderer->render($torender); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
While this will error etc, this module is basically a pass through as HTML the native. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 new |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
This initiates the object. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head3 args hash ref |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head4 obj |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This is the L object to render. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head4 toader |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This is the L object to use. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $foo=Toader::Render::Directory::backends::html->new(\%args); |
50
|
|
|
|
|
|
|
if($foo->error){ |
51
|
|
|
|
|
|
|
warn('error: '.$foo->error.":".$foo->errorString); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new{ |
57
|
0
|
|
|
0
|
1
|
|
my %args; |
58
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
59
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $self={ |
63
|
|
|
|
|
|
|
error=>undef, |
64
|
|
|
|
|
|
|
errorString=>'', |
65
|
|
|
|
|
|
|
perror=>undef, |
66
|
|
|
|
|
|
|
errorExtra=>{ |
67
|
|
|
|
|
|
|
flags=>{ |
68
|
|
|
|
|
|
|
1=>'noObj', |
69
|
|
|
|
|
|
|
2=>'noToaderObj', |
70
|
|
|
|
|
|
|
3=>'objPerror', |
71
|
|
|
|
|
|
|
4=>'toaderPerror', |
72
|
|
|
|
|
|
|
5=>'noDirSet', |
73
|
|
|
|
|
|
|
6=>'nothingToRender', |
74
|
|
|
|
|
|
|
}, |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
}; |
77
|
0
|
|
|
|
|
|
bless $self; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#make sure we have a Toader::Directory object. |
80
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{obj} ) ){ |
81
|
0
|
|
|
|
|
|
$self->{perror}=1; |
82
|
0
|
|
|
|
|
|
$self->{error}=1; |
83
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader::Directory object'; |
84
|
0
|
|
|
|
|
|
$self->warn; |
85
|
0
|
|
|
|
|
|
return $self; |
86
|
|
|
|
|
|
|
} |
87
|
0
|
0
|
|
|
|
|
if ( ref( $args{obj} ) ne 'Toader::Directory' ){ |
88
|
0
|
|
|
|
|
|
$self->{perror}=1; |
89
|
0
|
|
|
|
|
|
$self->{error}=1; |
90
|
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader::Directory object, but a "'. |
91
|
0
|
|
|
|
|
|
ref( $args{obj} ).'"'; |
92
|
0
|
|
|
|
|
|
$self->warn; |
93
|
0
|
|
|
|
|
|
return $self; |
94
|
|
|
|
|
|
|
} |
95
|
0
|
|
|
|
|
|
$self->{obj}=$args{obj}; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#make sure the object does not have a permanent error set |
98
|
0
|
0
|
|
|
|
|
if( ! $self->{obj}->errorblank ){ |
99
|
0
|
|
|
|
|
|
$self->{perror}=1; |
100
|
0
|
|
|
|
|
|
$self->{error}=3; |
101
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::Directory object has a permanent error set'; |
102
|
0
|
|
|
|
|
|
$self->warn; |
103
|
0
|
|
|
|
|
|
return $self; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
#make sure a Toader object is given |
107
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{toader} ) ){ |
108
|
0
|
|
|
|
|
|
$self->{perror}=1; |
109
|
0
|
|
|
|
|
|
$self->{error}=2; |
110
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader object'; |
111
|
0
|
|
|
|
|
|
$self->warn; |
112
|
0
|
|
|
|
|
|
return $self; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
0
|
|
|
|
|
if ( ref( $args{toader} ) ne 'Toader' ){ |
115
|
0
|
|
|
|
|
|
$self->{perror}=1; |
116
|
0
|
|
|
|
|
|
$self->{error}=2; |
117
|
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader object, but a "'. |
118
|
0
|
|
|
|
|
|
ref( $args{toader} ).'"'; |
119
|
0
|
|
|
|
|
|
$self->warn; |
120
|
0
|
|
|
|
|
|
return $self; |
121
|
|
|
|
|
|
|
} |
122
|
0
|
|
|
|
|
|
$self->{toader}=$args{toader}; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
#make sure the Toader object does not have a permanent error set |
125
|
0
|
0
|
|
|
|
|
if( ! $self->{toader}->errorblank ){ |
126
|
0
|
|
|
|
|
|
$self->{perror}=1; |
127
|
0
|
|
|
|
|
|
$self->{error}=4; |
128
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader object has an permanent error set'; |
129
|
0
|
|
|
|
|
|
$self->warn; |
130
|
0
|
|
|
|
|
|
return $self; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
#make sure a directory is set |
134
|
0
|
0
|
|
|
|
|
if( ! defined( $self->{obj}->dirGet ) ){ |
135
|
0
|
|
|
|
|
|
$self->{perror}=1; |
136
|
0
|
|
|
|
|
|
$self->{error}=5; |
137
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::Directory object does not have a directory set'; |
138
|
0
|
|
|
|
|
|
$self->warn; |
139
|
0
|
|
|
|
|
|
return $self; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
return $self; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 render |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This renders the object. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
No arguments are taken. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub render{ |
154
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
155
|
0
|
|
|
|
|
|
my $torender=$_[1]; |
156
|
|
|
|
|
|
|
|
157
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
158
|
0
|
|
|
|
|
|
return undef; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
0
|
0
|
|
|
|
|
if ( !defined( $torender ) ){ |
162
|
0
|
|
|
|
|
|
$self->{error}=6; |
163
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing to render specified'; |
164
|
0
|
|
|
|
|
|
$self->warn; |
165
|
0
|
|
|
|
|
|
return undef; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
|
return $torender; |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 ERROR CODES |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head2 1, noObj |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
No L object specified. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head2 2, noToaderObj |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
No L object specified. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 3, objPerror |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
The L object has a permanent error set. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 4, toaderPerror |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
The L object has a permanent error set. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head2 5, noDirSet |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
The L object does not have a directory set. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head2 6, nothingToRender |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Nothing specified to render. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 AUTHOR |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 BUGS |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
204
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
205
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head1 SUPPORT |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
perldoc Toader::Render::Directory::backends::html |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
You can also look for information at: |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=over 4 |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
L |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
L |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item * CPAN Ratings |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
L |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item * Search CPAN |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
L |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=back |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
Copyright 2013. Zane C. Bowers-Hadley. |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
245
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
246
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=cut |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
1; # End of Toader::Render::Directory::backends::html |