DBD::Go...rostream(3)
π DBD::Gofer::Transport::corostream π
okay bestie, so this is the manual page for DBD::Gofer::Transport::corostream β an async DBD::Gofer stream transport that runs on Coro + AnyEvent. yes, both. at the same time. it's giving main character energy fr fr β¨
β¨ NAME β¨
DBD::Gofer::Transport::corostream β async DBD::Gofer stream transport, powered by Coro and AnyEvent π¦
π SYNOPSIS π
so like, literally just:
DBI_AUTOPROXY="dbi:Gofer:transport=corostream" perl some-perl-script-using-dbi.pl
or, if you're feeling β¨fancyβ¨:
$dsn = ...; # the DSN for the driver and database you want to use
$dbh = DBI->connect("dbi:Gofer:transport=corostream;dsn=$dsn", ...);
π DESCRIPTION π
The BIG WIN π from using Coro is that it lets you keep using all your existing DBI frameworks β like DBIx::Class β without them melting down. iykyk. no cap, that's the whole point. π
π KNOWN ISSUES AND LIMITATIONS π
okay so, not everything is slay, we gotta be honest:
- Uses
Coro::Selectso it altersCORE::selectglobally Parent class probably needs refactoring so we could do a more encapsulated approach instead. yeah. it's a whole thing. π - Doesn't prevent multiple concurrent requests Probably just needs a per-connection semaphore tbh. π
- Coro has many caveats. Caveat emptor. like, buyer beware, bestie. the vibes are immaculate but the caveats are real. π«Ά
π STATUS π
THIS IS CURRENTLY JUST A PROOF-OF-CONCEPT IMPLEMENTATION FOR EXPERIMENTATION.
so like, please note that the author has no plans to develop this code further himself. but he'd very much welcome contributions!! interested? let him know!! π π
πΈ AUTHOR πΈ
Tim Bunce, <http://www.tim.bunce.name> π
π LICENCE AND COPYRIGHT π
Copyright (c) 2010, Tim Bunce, Ireland. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
(translation: it's free, go wild, same terms as Perl, check perlartistic for the receipts β)
π¦ SEE ALSO π¦
DBD::Gofer::Transport::streamDBD::Gofer
π§ APPENDIX π§
Example code, bestie, look at it, it's so cute:
#!perl
use strict;
use warnings;
use Time::HiRes qw(time);
BEGIN { $ENV{PERL_ANYEVENT_STRICT} = 1; $ENV{PERL_ANYEVENT_VERBOSE} = 1; }
use AnyEvent;
BEGIN { $ENV{DBI_TRACE} = 0; $ENV{DBI_GOFER_TRACE} = 0; $ENV{DBD_GOFER_TRACE} = 0; };
use DBI;
$ENV{DBI_AUTOPROXY} = 'dbi:Gofer:transport=corostream';
my $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub {
warn sprintf "-tick- %.2f\n", time
} );
warn "connecting...\n";
my $dbh = DBI->connect("dbi:NullP:");
warn "...connected\n";
for (1..3) {
warn "entering DBI...\n";
$dbh->do("sleep 0.3"); # pseudo-sql understood by the DBD::NullP driver
warn "...returned\n";
}
warn "done.";
Example output β look at those ticks firing while we're still inside the do() πβ¨:
$ perl corogofer.pl
connecting...
-tick- 1293631437.14
-tick- 1293631437.14
...connected
entering DBI...
-tick- 1293631437.25
-tick- 1293631437.35
-tick- 1293631437.45
-tick- 1293631437.55
...returned
entering DBI...
-tick- 1293631437.66
-tick- 1293631437.76
-tick- 1293631437.86
...returned
entering DBI...
-tick- 1293631437.96
-tick- 1293631438.06
-tick- 1293631438.16
...returned
done. at corogofer.pl line 39.
You can see that the timer callback is firing while the code 'waits' inside the do() method for the response from the database. Normally that would block. π«β but not today bestie, not today π
π₯
aaaand that's the whole page!! π this was perl v5.42.3, dated 2026-10-19, from DBD::Go...rostream(3) β User Contributed Perl Documentation. mwah. go forth and proxy asynchronously π¦πβ¨
π¦ where this page comes from
- fedora 43: perl-DBI 1.656-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-DBI 1.656-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms