line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader::Render::Page::backends::html; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20715
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Error::Helper'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
766
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Toader::Render::Page::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::Page::backends::html; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $renderer=Toader::Render::Page::backends::html->new({ toader=>$oader, obj=>$pageObj }); |
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::Page::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
|
|
|
|
|
|
|
}; |
67
|
0
|
|
|
|
|
|
bless $self; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#make sure we have a Toader::Directory object. |
70
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{obj} ) ){ |
71
|
0
|
|
|
|
|
|
$self->{perror}=1; |
72
|
0
|
|
|
|
|
|
$self->{error}=1; |
73
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader::Directory object'; |
74
|
0
|
|
|
|
|
|
$self->warn; |
75
|
0
|
|
|
|
|
|
return $self; |
76
|
|
|
|
|
|
|
} |
77
|
0
|
0
|
|
|
|
|
if ( ref( $args{obj} ) ne 'Toader::Page' ){ |
78
|
0
|
|
|
|
|
|
$self->{perror}=1; |
79
|
0
|
|
|
|
|
|
$self->{error}=1; |
80
|
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader::Page object, but a "'. |
81
|
0
|
|
|
|
|
|
ref( $args{obj} ).'"'; |
82
|
0
|
|
|
|
|
|
$self->warn; |
83
|
0
|
|
|
|
|
|
return $self; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
$self->{obj}=$args{obj}; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#make sure the object does not have a permanent error set |
88
|
0
|
0
|
|
|
|
|
if( ! $self->{obj}->errorblank ){ |
89
|
0
|
|
|
|
|
|
$self->{perror}=1; |
90
|
0
|
|
|
|
|
|
$self->{error}=3; |
91
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::Page object has a permanent error set'; |
92
|
0
|
|
|
|
|
|
$self->warn; |
93
|
0
|
|
|
|
|
|
return $self; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#make sure a Toader object is given |
97
|
0
|
0
|
|
|
|
|
if ( ! defined( $args{toader} ) ){ |
98
|
0
|
|
|
|
|
|
$self->{perror}=1; |
99
|
0
|
|
|
|
|
|
$self->{error}=2; |
100
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing defined for the Toader object'; |
101
|
0
|
|
|
|
|
|
$self->warn; |
102
|
0
|
|
|
|
|
|
return $self; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
0
|
|
|
|
|
if ( ref( $args{toader} ) ne 'Toader' ){ |
105
|
0
|
|
|
|
|
|
$self->{perror}=1; |
106
|
0
|
|
|
|
|
|
$self->{error}=2; |
107
|
|
|
|
|
|
|
$self->{errorString}='The specified object is not a Toader object, but a "'. |
108
|
0
|
|
|
|
|
|
ref( $args{toader} ).'"'; |
109
|
0
|
|
|
|
|
|
$self->warn; |
110
|
0
|
|
|
|
|
|
return $self; |
111
|
|
|
|
|
|
|
} |
112
|
0
|
|
|
|
|
|
$self->{toader}=$args{toader}; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#make sure the Toader object does not have a permanent error set |
115
|
0
|
0
|
|
|
|
|
if( ! $self->{toader}->errorblank ){ |
116
|
0
|
|
|
|
|
|
$self->{perror}=1; |
117
|
0
|
|
|
|
|
|
$self->{error}=4; |
118
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader object has an permanent error set'; |
119
|
0
|
|
|
|
|
|
$self->warn; |
120
|
0
|
|
|
|
|
|
return $self; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
#make sure a directory is set |
124
|
0
|
0
|
|
|
|
|
if( ! defined( $self->{obj}->dirGet ) ){ |
125
|
0
|
|
|
|
|
|
$self->{perror}=1; |
126
|
0
|
|
|
|
|
|
$self->{error}=5; |
127
|
0
|
|
|
|
|
|
$self->{errorString}='The Toader::Directory object does not have a directory set'; |
128
|
0
|
|
|
|
|
|
$self->warn; |
129
|
0
|
|
|
|
|
|
return $self; |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
return $self; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 render |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This renders the object. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
No arguments are taken. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub render{ |
144
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
145
|
0
|
|
|
|
|
|
my $torender=$_[1]; |
146
|
|
|
|
|
|
|
|
147
|
0
|
0
|
|
|
|
|
if ( ! $self->errorblank ){ |
148
|
0
|
|
|
|
|
|
return undef; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
0
|
0
|
|
|
|
|
if ( !defined( $torender ) ){ |
152
|
0
|
|
|
|
|
|
$self->{error}=6; |
153
|
0
|
|
|
|
|
|
$self->{errorString}='Nothing to render specified'; |
154
|
0
|
|
|
|
|
|
$self->warn; |
155
|
0
|
|
|
|
|
|
return undef; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
return $torender; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 ERROR CODES |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head2 1 |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
No L object specified. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 2 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
No L object specified. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 3 |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The L object has a permanent error set. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 4 |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
The L object has a permanent error set. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 5 |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The L object does not have a directory set. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head2 6 |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Nothing specified to render. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head1 BUGS |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
194
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
195
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 SUPPORT |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
perldoc Toader::Render::Page::backends::html |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
You can also look for information at: |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=over 4 |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
L |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item * CPAN Ratings |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item * Search CPAN |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
L |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=back |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
Copyright 2011. Zane C. Bowers-Hadley. |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
235
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
236
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=cut |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
1; # End of Toader::Render::Directory::backends::html |