{
    "mode": "perldoc",
    "parameter": "DBD::Gofer::Transport::corostream",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DBD%3A%3AGofer%3A%3ATransport%3A%3Acorostream/json",
    "generated": "2026-06-13T08:17:34Z",
    "synopsis": "DBIAUTOPROXY=\"dbi:Gofer:transport=corostream\" perl some-perl-script-using-dbi.pl\nor\n$dsn = ...; # the DSN for the driver and database you want to use\n$dbh = DBI->connect(\"dbi:Gofer:transport=corostream;dsn=$dsn\", ...);",
    "sections": {
        "NAME": {
            "content": "DBD::Gofer::Transport::corostream - Async DBD::Gofer stream transport using Coro and AnyEvent\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "DBIAUTOPROXY=\"dbi:Gofer:transport=corostream\" perl some-perl-script-using-dbi.pl\n\nor\n\n$dsn = ...; # the DSN for the driver and database you want to use\n$dbh = DBI->connect(\"dbi:Gofer:transport=corostream;dsn=$dsn\", ...);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The *BIG WIN* from using Coro is that it enables the use of existing DBI frameworks like\nDBIx::Class.\n",
            "subsections": []
        },
        "KNOWN ISSUES AND LIMITATIONS": {
            "content": "- Uses Coro::Select so alters CORE::select globally\nParent class probably needs refactoring to enable a more encapsulated approach.\n\n- Doesn't prevent multiple concurrent requests\nProbably just needs a per-connection semaphore\n\n- Coro has many caveats. Caveat emptor.\n",
            "subsections": []
        },
        "STATUS": {
            "content": "THIS IS CURRENTLY JUST A PROOF-OF-CONCEPT IMPLEMENTATION FOR EXPERIMENTATION.\n\nPlease note that I have no plans to develop this code further myself. I'd very much welcome\ncontributions. Interested? Let me know!\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Tim Bunce, <http://www.tim.bunce.name>\n",
            "subsections": []
        },
        "LICENCE AND COPYRIGHT": {
            "content": "Copyright (c) 2010, Tim Bunce, Ireland. All rights reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See perlartistic.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "DBD::Gofer::Transport::stream\n\nDBD::Gofer\n",
            "subsections": []
        },
        "APPENDIX": {
            "content": "Example code:\n\n#!perl\n\nuse strict;\nuse warnings;\nuse Time::HiRes qw(time);\n\nBEGIN { $ENV{PERLANYEVENTSTRICT} = 1; $ENV{PERLANYEVENTVERBOSE} = 1; }\n\nuse AnyEvent;\n\nBEGIN { $ENV{DBITRACE} = 0; $ENV{DBIGOFERTRACE} = 0; $ENV{DBDGOFERTRACE} = 0; };\n\nuse DBI;\n\n$ENV{DBIAUTOPROXY} = 'dbi:Gofer:transport=corostream';\n\nmy $ticker = AnyEvent->timer( after => 0, interval => 0.1, cb => sub {\nwarn sprintf \"-tick- %.2f\\n\", time\n} );\n\nwarn \"connecting...\\n\";\nmy $dbh = DBI->connect(\"dbi:NullP:\");\nwarn \"...connected\\n\";\n\nfor (1..3) {\nwarn \"entering DBI...\\n\";\n$dbh->do(\"sleep 0.3\"); # pseudo-sql understood by the DBD::NullP driver\nwarn \"...returned\\n\";\n}\n\nwarn \"done.\";\n\nExample output:\n\n$ perl corogofer.pl\nconnecting...\n-tick- 1293631437.14\n-tick- 1293631437.14\n...connected\nentering DBI...\n-tick- 1293631437.25\n-tick- 1293631437.35\n-tick- 1293631437.45\n-tick- 1293631437.55\n...returned\nentering DBI...\n-tick- 1293631437.66\n-tick- 1293631437.76\n-tick- 1293631437.86\n...returned\nentering DBI...\n-tick- 1293631437.96\n-tick- 1293631438.06\n-tick- 1293631438.16\n...returned\ndone. at corogofer.pl line 39.\n\nYou can see that the timer callback is firing while the code 'waits' inside the do() method for\nthe response from the database. Normally that would block.\n",
            "subsections": []
        }
    },
    "summary": "DBD::Gofer::Transport::corostream - Async DBD::Gofer stream transport using Coro and AnyEvent",
    "flags": [],
    "examples": [],
    "see_also": []
}