line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader::Render::Entry::backends::html; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21581
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Error::Helper'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
731
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Toader::Render::Entry::backends::html - This handles the html backend stuff for Toader::Render::Entry. |
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::Entry::backends::html; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $renderer=Toader::Render::Directory::backends::html->new({ toader=>$toader, obj=>$entryObj }); |
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::Entry::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::Entry 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::Entry' ){ |
88
|
0
|
|
|
|
|
|
$self->{perror}=1; |
89
|
0
|
|
|
|
|
|
$self->{error}=1; |
90
|
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader::Entry 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::Entry 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::Entry 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
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
return $torender; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 ERROR CODES |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 1, noObj |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
No L object specified. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 2, noToaderObj |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
No L object specified. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 3, objPerror |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
The L object has a permanent error set. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 4, toaderPerror |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
The L object has a permanent error set. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 5, noDirSet |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
The L object does not have a directory set. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head2 6, nothingToRender |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Nothing specified to render. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 AUTHOR |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 BUGS |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
206
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
207
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head1 SUPPORT |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
perldoc Toader::Render::Entry::backends::html |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
You can also look for information at: |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=over 4 |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
L |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
L |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * CPAN Ratings |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
L |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=item * Search CPAN |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
L |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=back |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
Copyright 2013. Zane C. Bowers-Hadley. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
247
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
248
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=cut |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
1; # End of Toader::Render::Entry::backends::html |