[BACK]Return to Cached.pm CVS log [TXT][DIR] Up to [local] / openbsd / OpenBSDTorrents / lib / BT / MetaInfo

Diff for /openbsd/OpenBSDTorrents/lib/BT/MetaInfo/Cached.pm between version 1.7 and 1.8

version 1.7, 2005/05/05 21:29:13 version 1.8, 2005/05/05 22:44:03
Line 24 
Line 24 
   
         my $cache = new Cache::FileCache( $cache_settings );          my $cache = new Cache::FileCache( $cache_settings );
   
         my $obj = (defined($file)) ? _load($file, $cache) : {};          my $obj = (defined($file)) ? _load($file, $cache) : {};
   
           bless($obj, $class);
   
         $obj->{cache} = $cache;          $obj->{cache} = $cache;
   
         return(bless($obj, $class));          return $obj;
 }  }
   
 sub _load {  sub _load {
         my $file = shift;          my $file = shift;
Line 49 
Line 51 
   
 sub save  sub save
 {  {
         my ($self, $file) = @_;          my $self = shift;
           my $file = shift;
         my $basename = basename($file);          my $basename = basename($file);
   
         $self->SUPER::save($file, @_);          my $cache = delete $self->{cache};
   
         my %info_hash = %$self; # unbless          if ( $self->SUPER::save($file, @_) ) {
         $self->cache->set->($basename, \%info_hash)                  my %info_hash = %$self; # unbless
                   $cache->set($basename, \%info_hash)
           }
   
           $self->{cache} = $cache;
 }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>