/[webpac2]/trunk/lib/WebPAC/Output/TT.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 /trunk/lib/WebPAC/Output/TT.pm

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

revision 69 by dpavlin, Tue Nov 15 14:31:12 2005 UTC revision 70 by dpavlin, Sat Nov 19 23:48:24 2005 UTC
# Line 70  Create output from in-memory data struct Line 70  Create output from in-memory data struct
70    
71   my $text = $tt->apply(   my $text = $tt->apply(
72          template => 'text.tt',          template => 'text.tt',
73          data => \@ds          data => $ds
74   );   );
75    
76  It also has follwing template toolikit filter routies defined:  It also has follwing template toolikit filter routies defined:
# Line 90  sub apply { Line 90  sub apply {
90    
91  =head3 tt_filter_type  =head3 tt_filter_type
92    
93  filter to return values of specified from @ds  filter to return values of specified from $ds
94    
95  =cut  =cut
96    
# Line 109  filter to return values of specified fro Line 109  filter to return values of specified fro
109    
110                          my ($name,$join) = @_;                          my ($name,$join) = @_;
111    
112                          die "no data array" unless ($data->{'data'} && ref($data->{'data'}) eq 'ARRAY');                          die "no data hash" unless ($data->{'data'} && ref($data->{'data'}) eq 'HASH');
113                          # Hm? Should we die here?                          # Hm? Should we die here?
114                          return unless ($name);                          return unless ($name);
115    
116                          my $item = first { $_->{'name'} eq $name } @{ $data->{'data'} };                          my $item = $data->{'data'}->{$name} || return;
   
                         return unless($item);  
117    
118                          my $v = $item->{$type} || return;                          my $v = $item->{$type} || return;
119    
# Line 153  to a file. Line 151  to a file.
151   $tt->to_file(   $tt->to_file(
152          file => 'out.txt',          file => 'out.txt',
153          template => 'text.tt',          template => 'text.tt',
154          data => \@ds          data => $ds
155   );   );
156    
157  =cut  =cut

Legend:
Removed from v.69  
changed lines
  Added in v.70

  ViewVC Help
Powered by ViewVC 1.1.26