YAML::MLDBM - Use tied hash db-s with Python and Ruby


YAML-MLDBM documentation  | view source Contained in the YAML-MLDBM distribution.

Index


NAME

Top

YAML::MLDBM - Use tied hash db-s with Python and Ruby

SYNOPSIS

Top

    use YAML::MLDBM;

    my $h = YAML::MLDBM->new('./my_dbm_file');

    $h->{'@INC'} = \@INC;
    $h->{'%ENV'} = \%ENV;

    use Data::Dumper;
    print Dumper $h;

DESCRIPTION

Top

This module is similar to MLDBM except that it stores data internally as YAML, instead of Data::Dumper or Storable. By doing this, you can create tied hash DBM databases that can be used seamlessly in Python or Ruby applications. That's because those languages also have YAML and DBM modules. As other languages get YAML support, you should be able to use YAML::MLDBM with them as well.

This module is a wrapper around MLDBM, but you open a DBM file using the new() method, instead of using a tie. new() will return a reference to a tied hash.

You can also use YAML as a serialization method for MLDBM itself:

    use MLDBM qw(SDBM_File YAML);
    use Fcntl;

    tie %h, 'MLDBM', './my_dbm_file', O_CREAT|O_RDWR, 0640 or die $!;

    $h{'@INC'} = \@INC;
    $h{'%ENV'} = \%ENV;

    use Data::Dumper;
    print Dumper \%h;

This has the same affect, but is more verbose. It does offer you more control if you want it though.

SEE ALSO

Top

See MLDBM, AnyDBM_File and YAML for more information.

AUTHOR

Top

Brian Ingerson <ingy@cpan.org>

COPYRIGHT

Top


YAML-MLDBM documentation  | view source Contained in the YAML-MLDBM distribution.