/[webpac2]/trunk/lib/WebPAC/DB.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/DB.pm

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

revision 50 by dpavlin, Mon Nov 14 16:15:45 2005 UTC revision 113 by dpavlin, Wed Nov 23 00:14:05 2005 UTC
# Line 110  sub path { Line 110  sub path {
110    
111  Retrive from disk one data_structure records using field 000 as key  Retrive from disk one data_structure records using field 000 as key
112    
113    my @ds = $db->load_ds($rec);    my $ds = $db->load_ds($rec);
114    
115  This function will also perform basic sanity checking on returned  This function will also perform basic sanity checking on returned
116  data and disable caching if data is corrupted (or changed since last  data and disable caching if data is corrupted (or changed since last
117  update).  update).
118    
119  Returns array or undef if cacheing is disabled or unavailable.  Returns hash or undef if cacheing is disabled or unavailable.
120    
121  =cut  =cut
122    
# Line 154  sub load_ds { Line 154  sub load_ds {
154                                          }                                          }
155                                  };                                  };
156                                  if ($ok && $ds_ref->{'ds'}) {                                  if ($ok && $ds_ref->{'ds'}) {
157                                          return @{ $ds_ref->{'ds'} };                                          return $ds_ref->{'ds'};
158                                  } else {                                  } else {
159                                          $log->warn("cache entry $cache_path corrupt. Use rm $cache_path/* to re-create it on next run!");                                          $log->warn("cache entry $cache_path corrupt. Use rm $cache_path/* to re-create it on next run!");
160                                          undef $self->{'path'};                                          undef $self->{'path'};
# Line 173  sub load_ds { Line 173  sub load_ds {
173  Store data_structure on disk.  Store data_structure on disk.
174    
175    $db->save_ds(    $db->save_ds(
176          ds => \@ds,          ds => $ds,
177          current_filename => $self->{'current_filename'},          current_filename => $self->{'current_filename'},
178          headline => $self->{'headline'},          headline => $self->{'headline'},
179    );    );
# Line 198  sub save_ds { Line 198  sub save_ds {
198    
199          $log->logdie("save_ds without cache_file -- did you called gs_get before?") unless ($self->{'cache_file'});          $log->logdie("save_ds without cache_file -- did you called gs_get before?") unless ($self->{'cache_file'});
200    
201          foreach my $e (qw/ds current_filename headline/) {          $log->logdie("need ds") unless ($arg->{ds});
202                  $log->logconfess("missing $e") unless $arg->{$e};  
203            foreach my $e (qw/current_filename headline/) {
204                    my $mfn = $arg->{ds}->{000}->[0] || '?';
205                    $log->warn("missing $e in record $mfn") unless $arg->{$e};
206          }          }
207    
208          $log->debug("creating storable cache file ",$self->{'cache_file'});          $log->debug("creating storable cache file ",$self->{'cache_file'});

Legend:
Removed from v.50  
changed lines
  Added in v.113

  ViewVC Help
Powered by ViewVC 1.1.26