AnyEvent::BDB - truly asynchronous berkeley db access


AnyEvent-BDB documentation Contained in the AnyEvent-BDB distribution.

Index


Code Index:

NAME

Top

AnyEvent::BDB - truly asynchronous berkeley db access

SYNOPSIS

Top

   use AnyEvent::BDB;
   use BDB;

   # can now use any of the requests your BDB module supports
   # as long as you use an event loop supported by AnyEvent.

DESCRIPTION

Top

This module is an AnyEvent user, you need to make sure that you use and run a supported event loop.

Loading this module will install the necessary magic to seamlessly integrate BDB into AnyEvent, i.e. you no longer need to concern yourself with calling BDB::poll_cb or any of that stuff (you still can, but this module will do it in case you don't).

The AnyEvent watcher can be disabled by executing undef $AnyEvent::BDB::WATCHER. Please notify the author of when and why you think this was necessary.

SEE ALSO

Top

AnyEvent, Coro::BDB (for a more natural syntax).

AUTHOR

Top

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/


AnyEvent-BDB documentation Contained in the AnyEvent-BDB distribution.
package AnyEvent::BDB;

use strict;
no warnings;

use AnyEvent ();
use BDB ();

use base Exporter::;

our $VERSION = '1.1';
our $WATCHER;

my $guard = AnyEvent::post_detect {
   $WATCHER = AnyEvent->io (fh => BDB::poll_fileno, poll => 'r', cb => \&BDB::poll_cb);
};
$WATCHER ||= $guard;

BDB::_on_next_submit \&AnyEvent::detect;

1