[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/5.10.0/Memoize/ -> Storable.pm (source)

   1  package Memoize::Storable;
   2  
   3  =head1 NAME
   4  
   5  Memoize::Storable - store Memoized data in Storable database
   6  
   7  =head1 DESCRIPTION
   8  
   9  See L<Memoize>.
  10  
  11  =cut
  12  
  13  use Storable ();
  14  $VERSION = 0.65;
  15  $Verbose = 0;
  16  
  17  sub TIEHASH {
  18    require Carp if $Verbose;
  19    my $package = shift;
  20    my $filename = shift;
  21    my $truehash = (-e $filename) ? Storable::retrieve($filename) : {};
  22    my %options;
  23    print STDERR "Memoize::Storable::TIEHASH($filename, @_)\n" if $Verbose;
  24    @options{@_} = ();
  25    my $self = 
  26      {FILENAME => $filename, 
  27       H => $truehash, 
  28       OPTIONS => \%options
  29      };
  30    bless $self => $package;
  31  }
  32  
  33  sub STORE {
  34    require Carp if $Verbose;
  35    my $self = shift;
  36    print STDERR "Memoize::Storable::STORE(@_)\n" if $Verbose;
  37    $self->{H}{$_[0]} = $_[1];
  38  }
  39  
  40  sub FETCH {
  41    require Carp if $Verbose;
  42    my $self = shift;
  43    print STDERR "Memoize::Storable::FETCH(@_)\n" if $Verbose;
  44    $self->{H}{$_[0]};
  45  }
  46  
  47  sub EXISTS {
  48    require Carp if $Verbose;
  49    my $self = shift;
  50    print STDERR "Memoize::Storable::EXISTS(@_)\n" if $Verbose;
  51    exists $self->{H}{$_[0]};
  52  }
  53  
  54  sub DESTROY {
  55    require Carp if $Verbose;
  56    my $self= shift;
  57    print STDERR "Memoize::Storable::DESTROY(@_)\n" if $Verbose;
  58    if ($self->{OPTIONS}{'nstore'}) {
  59      Storable::nstore($self->{H}, $self->{FILENAME});
  60    } else {
  61      Storable::store($self->{H}, $self->{FILENAME});
  62    }
  63  }
  64  
  65  sub FIRSTKEY {
  66    'Fake hash from Memoize::Storable';
  67  }
  68  
  69  sub NEXTKEY {
  70    undef;
  71  }
  72  1;


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1