/[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 44 by dpavlin, Mon Nov 14 16:12:01 2005 UTC revision 45 by dpavlin, Mon Nov 14 16:12:43 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    
 print "### name, join = ",Dumper($name);  
   
114                          my $item = first { $_->{'name'} eq $name } @{ $data->{'data'} };                          my $item = first { $_->{'name'} eq $name } @{ $data->{'data'} };
115    
116                          return unless($item);                          return unless($item);
117    
 print "### item = ",Dumper($item);  
   
118                          my $v = $item->{$type} || return;                          my $v = $item->{$type} || return;
119    
120                          if (ref($v) eq 'ARRAY') {                          if (ref($v) eq 'ARRAY') {
# Line 125  print "### item = ",Dumper($item); Line 125  print "### item = ",Dumper($item);
125                                          $v = join($join, @{$v});                                          $v = join($join, @{$v});
126                                  }                                  }
127                          }                          }
128  print "### v = $v\n";  
129                          return $v;                          return $v;
130                  }                  }
131          }          }

Legend:
Removed from v.44  
changed lines
  Added in v.45

  ViewVC Help
Powered by ViewVC 1.1.26