… | |
… | |
3 | AnyEvent::DBI - asynchronous DBI access |
3 | AnyEvent::DBI - asynchronous DBI access |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use AnyEvent::DBI; |
7 | use AnyEvent::DBI; |
|
|
8 | |
|
|
9 | my $cv = AnyEvent->condvar; |
|
|
10 | |
|
|
11 | my $dbh = new AnyEvent::DBI "DBI:SQLite:dbname=test.db", "", ""; |
|
|
12 | |
|
|
13 | $dbh->exec ("select * from test where num=?", 10, sub { |
|
|
14 | my ($rows) = @_; |
|
|
15 | |
|
|
16 | print "@$_\n" |
|
|
17 | for @$rows; |
|
|
18 | |
|
|
19 | $cv->broadcast; |
|
|
20 | }); |
|
|
21 | |
|
|
22 | # asynchronously do sth. else here |
|
|
23 | |
|
|
24 | $cv->wait; |
8 | |
25 | |
9 | =head1 DESCRIPTION |
26 | =head1 DESCRIPTION |
10 | |
27 | |
11 | This module is an L<AnyEvent> user, you need to make sure that you use and |
28 | This module is an L<AnyEvent> user, you need to make sure that you use and |
12 | run a supported event loop. |
29 | run a supported event loop. |