/[webpac2]/Webpacus/lib/Webpacus/Model/WebPAC.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Webpacus/lib/Webpacus/Model/WebPAC.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 164 by dpavlin, Sat Nov 26 16:21:51 2005 UTC revision 165 by dpavlin, Sat Nov 26 20:21:54 2005 UTC
# Line 235  sub search { Line 235  sub search {
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 );

Legend:
Removed from v.164  
changed lines
  Added in v.165

  ViewVC Help
Powered by ViewVC 1.1.26