/[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 43 by dpavlin, Mon Nov 14 16:12:01 2005 UTC revision 62 by dpavlin, Tue Nov 15 14:31:12 2005 UTC
# Line 73  Create output from in-memory data struct Line 73  Create output from in-memory data struct
73          data => \@ds          data => \@ds
74   );   );
75    
76    It also has follwing template toolikit filter routies defined:
77    
78  =cut  =cut
79    
80  sub apply {  sub apply {
# Line 86  sub apply { Line 88  sub apply {
88                  $log->logconfess("need $a") unless ($args->{$a});                  $log->logconfess("need $a") unless ($args->{$a});
89          }          }
90    
91          # filter to return value from @ds  =head3 tt_filter_type
92    
93    filter to return values of specified from @ds
94    
95    =cut
96    
97          sub tt_filter_type {          sub tt_filter_type {
98                  my ($data,$type) = @_;                  my ($data,$type) = @_;
# Line 101  sub apply { Line 107  sub apply {
107    
108                  return sub {                  return sub {
109    
 print "### data = ",Dumper($data);  
   
110                          my ($name,$join) = @_;                          my ($name,$join) = @_;
111    
112                          die "no data array" unless ($data->{'data'} && ref($data->{'data'}) eq 'ARRAY');                          die "no data array" unless ($data->{'data'} && ref($data->{'data'}) eq 'ARRAY');
113                            # Hm? Should we die here?
114  print "### name, join = ",Dumper($name);                          return unless ($name);
115    
116                          my $item = first { $_->{'name'} eq $name } @{ $data->{'data'} };                          my $item = first { $_->{'name'} eq $name } @{ $data->{'data'} };
117    
118                          return unless($item);                          return unless($item);
119    
 print "### item = ",Dumper($item);  
   
120                          my $v = $item->{$type} || return;                          my $v = $item->{$type} || return;
121    
122                          if (ref($v) eq 'ARRAY') {                          if (ref($v) eq 'ARRAY') {
# Line 125  print "### item = ",Dumper($item); Line 127  print "### item = ",Dumper($item);
127                                          $v = join($join, @{$v});                                          $v = join($join, @{$v});
128                                  }                                  }
129                          }                          }
130  print "### v = $v\n";  
131                          return $v;                          return $v;
132                  }                  }
133          }          }

Legend:
Removed from v.43  
changed lines
  Added in v.62

  ViewVC Help
Powered by ViewVC 1.1.26