Coro::DBI - asynchronous DBI access
use Coro::DBI; async { # some asynchronous thread my $i=0; while ($i++) { print "$i\n"; } }; my $dbh = DBI->connect("DBI:SQLite:dbname=test.db", "", ""); my $sth = $dbh->prepare("select * from test where num=?"); $sth->execute(10); while (my @row = $sth->fetchrow_array) { print "@row\n"; } $sth->finish; $dbh->disconnect;
This module changes the behavior of DBI::connect to move connections into a child process so they will not block other coros. It should be used before the first database connection is made.
DBI::connect
None of these methods need to be called for normal operation.
Starts the dbi_proxy child process.
dbi_proxy
Kills the dbi_proxy child process with SIGINT.
Returns the DBD::Proxy part of the data_source so it can be prepended to your data source when connecting.
data_source
You do not need to use the proxy_dsn directly.
Coro, DBI, AnyEvent::DBI, Coro::Mysql
Eric Clark, <eclark at genome.wustl.edu>
<eclark at genome.wustl.edu>
Currently uses a hard-coded default TCP port 5001.
Suffers from the same bugs and limitations as DBD::Proxy.
dbi_proxy child process will not shutdown automatically unless you are on Linux i386 or x86_64
To install Coro::DBI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coro::DBI
CPAN shell
perl -MCPAN -e shell install Coro::DBI
For more information on module installation, please visit the detailed CPAN module installation guide.