David Nicol > DirDB-Storable-0.07 > DirDB::Storable

Download:
DirDB/DirDB-Storable-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.07   Source  

NAME ^

DirDB::Storable - DirDB extended to pass complex things to Storable

SYNOPSIS ^

  use DirDB::Storable;
  tie my %PersistentData, 'DirDB', "./data";

DESCRIPTION ^

DirDB::Storable is an extended version of DirDB data persistence tool that uses the Storable module to store and retreive data that is other than scalars and hash references.

 tie my %d => DirDB, '/tmp/foodb';
 
 $d{ref1}->{ref2}->{ref3}->{ref4} = 'something'; 
 # 'something' is now stored in /tmp/foodb/ref1/ref2/ref3/ref4
 
 $d{ref5} = [1..99]; 
 # an array reference, with data, is now stored in /tmp/foodb/ref5/\ Storable

RISKS

Besides the potential stale lock problem with DirDB, there is a risk of confusion about what is and isn't tied into the persistence framework.

        $d{ref5}->[33] = 'cheese'; # not written out
        
        { 
          my $tmp = $d{ref5};
          $tmp->[33] = 'cheese';
          $d{ref5} = $tmp;        # a work-around
        }

TO DO

a set of Tie::Storable modules that the retreived stored objects could be tied to instead of the above-demonstrated hack would be cool.

EXPORT

None by default.

AUTHOR ^

David Nicol, davidnicol@cpan.org

LICENSE ^

GPL/Artistic (the same terms as Perl itself)

SEE ALSO ^

l<DirDB>

better read l<perltie> before trying to extend this