Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: sharing DBMs

by mp (Deacon)
on Oct 02, 2002 at 15:59 UTC ( #202301=note: print w/replies, xml ) Need Help??

in reply to sharing DBMs

I don't fully understand your question, but MLDBM::Sync will handle DBM locking for you.

Replies are listed 'Best First'.
Re: Re: sharing DBMs
by marvell (Pilgrim) on Oct 04, 2002 at 12:48 UTC
    Having read more into it, it appears my question is:

    Is there a perl module that allows you to us the concurrent data model (many read, one write) model for Berkeley DB in a tie way?

    That is to say, as one process writes, the other can read and it's there.

    Steve Marvell

      After reading more, and playing, here it is:

      #!/usr/bin/perl -w use strict; use BerkeleyDB; use Data::Dumper; my $env = new BerkeleyDB::Env( -Home => '/home/steve/test', -Flags => DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL ) || die "env error: $! $BerkeleyDB::Error"; my $db = (tie my %hash, 'BerkeleyDB::Hash', -Filename => 'db2.bdb', -Env => $env, -Flags => DB_CREATE) || die "db error: $! $BerkeleyDB::Error"; while (<>) { $hash{$1} = $2 if (/(.*)=(.*)/); print Dumper \%hash; } undef $db; untie %hash;

      Steve Marvell

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://202301]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (None)
    As of 2022-01-26 04:58 GMT
    Find Nodes?
      Voting Booth?
      In 2022, my preferred method to securely store passwords is:

      Results (69 votes). Check out past polls.