/[webpac2]/Webpacus2/lib/Webpacus/Action/Search.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 /Webpacus2/lib/Webpacus/Action/Search.pm

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

revision 961 by dpavlin, Thu Nov 1 00:17:53 2007 UTC revision 962 by dpavlin, Fri Nov 2 12:23:40 2007 UTC
# Line 145  sub next { Line 145  sub next {
145          warn "## next row = ", dump( $row ) if $debug;          warn "## next row = ", dump( $row ) if $debug;
146    
147          return sub {          return sub {
148                  my $name = shift || die "no name?";                  my ( $name, $delimiter ) = @_;
149                    # default delimiter is space
150                    $delimiter ||= ' ';
151                    die "no name?" unless $name;
152                  if ( defined $row->{$name} ) {                  if ( defined $row->{$name} ) {
153                          # XXX disabled, Template::Declare always want scalars :-(                          # XXX disabled, Template::Declare always want scalars :-(
154                          if ( 0 && wantarray ) {                          if ( 0 && wantarray ) {
# Line 155  sub next { Line 158  sub next {
158                                          return [ $row->{$name} ];                                          return [ $row->{$name} ];
159                                  }                                  }
160                          } else {                          } else {
161                                  if ( ref($row->{$name}) eq 'ARRAY' ) {                                  if ( ref($row->{$name}) eq 'ARRAY' && $delimiter ne 'ARRAY' ) {
162                                          return join(' ', @{ $row->{$name} });                                          warn "is array ", wantarray ? 'wantarray' : 'scalar', " $name";
163                                            return @{$row->{$name}} if wantarray;
164                                            return join( $delimiter, @{ $row->{$name} });
165                                  } else {                                  } else {
166                                            warn "not array ", wantarray ? 'wantarray' : 'scalar', " $name";
167                                          return $row->{$name};                                          return $row->{$name};
168                                  }                                  }
169                          }                          }

Legend:
Removed from v.961  
changed lines
  Added in v.962

  ViewVC Help
Powered by ViewVC 1.1.26