235 |
return \@html_results; |
return \@html_results; |
236 |
} |
} |
237 |
|
|
238 |
|
=head2 record |
239 |
|
|
240 |
|
my $html = $m->record( |
241 |
|
mfn => 42, |
242 |
|
template => 'foo.tt', |
243 |
|
); |
244 |
|
|
245 |
|
This will load one record, convert it to html using C<template> and return |
246 |
|
it. |
247 |
|
|
248 |
|
=cut |
249 |
|
|
250 |
|
sub record { |
251 |
|
my $self = shift; |
252 |
|
|
253 |
|
my $args = {@_}; |
254 |
|
my $log = $self->{log}; |
255 |
|
$log->debug("args: " . Dumper( $args )); |
256 |
|
|
257 |
|
foreach my $f (qw/mfn template/) { |
258 |
|
$log->die("need $f") unless ($args->{$f}); |
259 |
|
} |
260 |
|
|
261 |
|
my $mfn = $args->{mfn}; |
262 |
|
|
263 |
|
my $ds = $self->{db}->load_ds( $mfn ) || $log->error("can't load_ds( $mfn )") && next; |
264 |
|
|
265 |
|
my $html = $self->{out}->apply( |
266 |
|
template => $args->{template}, |
267 |
|
data => $ds, |
268 |
|
); |
269 |
|
|
270 |
|
$html = $self->{iconv}->convert( $html ) || $log->error("can't convert: $html"); |
271 |
|
|
272 |
|
return $html; |
273 |
|
} |
274 |
|
|
275 |
=head2 save_html |
=head2 save_html |
276 |
|
|
277 |
$m->save_html( '/full/path/to/file', $content ); |
$m->save_html( '/full/path/to/file', $content ); |