File Coverage

blib/lib/AnyEvent/BDB.pm
Criterion Covered Total %
statement 25 27 92.5
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 34 36 94.4


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             AnyEvent::BDB - truly asynchronous berkeley db access
4              
5             =head1 SYNOPSIS
6              
7             use AnyEvent::BDB;
8             use BDB;
9              
10             # can now use any of the requests your BDB module supports
11             # as long as you use an event loop supported by AnyEvent.
12              
13             =head1 DESCRIPTION
14              
15             This module is an L user, you need to make sure that you use and
16             run a supported event loop.
17              
18             Loading this module will install the necessary magic to seamlessly
19             integrate L into L, i.e. you no longer need to concern
20             yourself with calling C or any of that stuff (you still
21             can, but this module will do it in case you don't).
22              
23             The AnyEvent watcher can be disabled by executing C
24             $AnyEvent::BDB::WATCHER>. Please notify the author of when and why you
25             think this was necessary.
26              
27             =cut
28              
29             package AnyEvent::BDB;
30              
31 1     1   641 use strict;
  1     1   2  
  1         34  
  1         5  
  1         1  
  1         35  
32 1     1   5 no warnings;
  1     1   2  
  1         37  
  1         6  
  1         1  
  1         36  
33              
34 1     1   1661 use AnyEvent ();
  1     1   6424  
  1         22  
  1         5  
  1         1  
  1         12  
35 1     1   719 use BDB ();
  0     1   0  
  0         0  
  1         5  
  1         1  
  1         16  
36              
37 1     1   4 use base Exporter::;
  1         1  
  1         1420  
38              
39             our $VERSION = '1.1';
40             our $WATCHER;
41              
42             my $guard = AnyEvent::post_detect {
43             $WATCHER = AnyEvent->io (fh => BDB::poll_fileno, poll => 'r', cb => \&BDB::poll_cb);
44             };
45             $WATCHER ||= $guard;
46              
47             BDB::_on_next_submit \&AnyEvent::detect;
48              
49             =head1 SEE ALSO
50              
51             L, L (for a more natural syntax).
52              
53             =head1 AUTHOR
54              
55             Marc Lehmann
56             http://home.schmorp.de/
57              
58             =cut
59              
60             1
61