/[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 942 by dpavlin, Wed Oct 31 12:34:33 2007 UTC revision 943 by dpavlin, Wed Oct 31 14:12:01 2007 UTC
# Line 95  __PACKAGE__->mk_accessors( qw( Line 95  __PACKAGE__->mk_accessors( qw(
95          index          index
96  ) );  ) );
97    
98    use lib '/data/webpac2/lib';
99    use WebPAC::Store;
100    
101  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
102    
103    my $debug = 1;
104    
105    my $store;
106    
107  sub next {  sub next {
108          my $self = shift;          my $self = shift;
         my $row = $self->index->fetch_hit_hashref;  
109    
110          warn "## next row = ", dump( $row );          if ( ! $store ) {
111                    $store = WebPAC::Store->new({
112                            debug => $debug,
113                    });
114                    warn "## create WebPAC::Store\n";
115            }
116    
117            my $hit = $self->index->fetch_hit_hashref;
118    
119            return unless $hit;
120    
121            warn "## next hit = ", dump( $hit ) if $debug;
122    
123            my $ds = $store->load_ds(
124                    database => $hit->{database},
125                    input    => $hit->{input},
126                    id       => $hit->{id},
127            );
128    
129            if ( ! $ds ) {
130                    warn "can't find ds for hit ", dump( $hit ), $/ unless $ds;
131                    return;
132            }
133    
134            my $row;
135    
136            foreach my $f ( keys %$ds ) {
137                    $row->{$f} = $ds->{$f}->{display} if defined $ds->{$f}->{display};
138            }
139    
140            return unless $row;
141    
142            $row->{$_} ||= $hit->{$_} foreach ( qw/database input id/ );
143    
144            warn "## next row = ", dump( $row ) if $debug;
145    
146          return $row;          return $row;
147  }  }

Legend:
Removed from v.942  
changed lines
  Added in v.943

  ViewVC Help
Powered by ViewVC 1.1.26