/[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 33 by dpavlin, Sun Jul 24 15:35:46 2005 UTC revision 42 by dpavlin, Mon Nov 14 16:11:40 2005 UTC
# Line 6  use strict; Line 6  use strict;
6  use base qw/WebPAC::Common/;  use base qw/WebPAC::Common/;
7    
8  use Template;  use Template;
9    use List::Util qw/first/;
10  use Data::Dumper;  use Data::Dumper;
11    
12  =head1 NAME  =head1 NAME
# Line 85  sub apply { Line 86  sub apply {
86                  $log->logconfess("need $a") unless ($args->{$a});                  $log->logconfess("need $a") unless ($args->{$a});
87          }          }
88    
89            # filter to return value from @ds
90    
91            sub tt_filter_d {
92    
93                    my ($name,$join) = @_;
94    
95    print "### name = ",Dumper($name);
96    
97                    my $item = first { $_->{'name'} eq $name } @{ $args->{'data'} };
98    
99                    return unless($item);
100    
101    print "### item = ",Dumper($item);
102    
103                    my $v = $item->{'display'} || return;
104    
105                    if (ref($v) eq 'ARRAY') {
106                            if ($#{$v} == 0) {
107                                    $v = $v->[0];
108                            } else {
109                                    $join = '&#182;<br/>' unless defined($join);
110                                    $v = join($join, @{$v});
111                            }
112                    }
113    print "### v = $v\n";
114                    return $v;
115            }
116            $args->{'d'} = \&tt_filter_d;
117    
118    
119          my $out;          my $out;
120    
121          $self->{'tt'}->process(          $self->{'tt'}->process(

Legend:
Removed from v.33  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26