Async.pm

filter: Statementstmt 78.5% 11 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 73.6% 14 / 19 CC 1 SCAR 2.2
CC
1
Cov
79%
connection
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Async/TransactionContext.pm ↑ Summary
1 package DBIO::MySQL::Async;
2 1 our $VERSION = '0.900000';
3 # ABSTRACT: Async MySQL/MariaDB storage for DBIO via EV::MariaDB
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use base 'DBIO::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 sub connection {
12 0 ▶ my ($self, @info) = @_;
Subroutine connection: not called CC=1 SCAR=6.9
Pod undocumented
13 0 $self->storage_type('+DBIO::MySQL::Async::Storage');
14 0 return $self->next::method(@info);
15 }
16  
17 1 1;
18  
19 __END__
20  
21 =pod
22  
23 =encoding UTF-8
24  
25 =head1 NAME
26  
27 DBIO::MySQL::Async - Async MySQL/MariaDB storage for DBIO via EV::MariaDB
28  
29 =head1 VERSION
30  
31 version 0.900000
32  
33 =head1 SYNOPSIS
34  
35 # Schema setup
36 my $schema = MyApp::Schema->connect(
37 'DBIO::MySQL::Async',
38 {
39 host => 'localhost',
40 dbname => 'myapp',
41 user => 'myapp',
42 password => 'secret',
43 pool_size => 10,
44 },
45 );
46  
47 # Async queries return Futures
48 $schema->resultset('Artist')->all_async->then(sub {
49 my @artists = @_;
50 say $_->name for @artists;
51 });
52  
53 # Pipeline mode — batch queries in one round-trip
54 $schema->storage->pipeline(sub {
55 my @futures;
56 push @futures, $schema->resultset('Artist')
57 ->create_async({ name => $_ }) for @names;
58 return Future->needs_all(@futures);
59 });
60  
61 # Sync methods still work (block the event loop)
62 my @all = $schema->resultset('Artist')->all;
63  
64 =head1 DESCRIPTION
65  
66 Async MySQL/MariaDB support for DBIO using L<EV::MariaDB>, a non-blocking
67 MariaDB client built on MariaDB's C client library. Bypasses DBI
68 entirely for maximum performance.
69  
70 Supports pipeline mode (batching queries in a single round-trip)
71 and prepared statements.
72  
73 =head1 EVENT LOOP COMPATIBILITY
74  
75 L<EV::MariaDB> uses the L<EV> event loop. This works with:
76  
77 =over 4
78  
79 =item * L<EV> directly
80  
81 =item * L<AnyEvent> (uses EV as backend when available)
82  
83 =item * L<IO::Async> via L<IO::Async::Loop::EV>
84  
85 =item * L<Mojolicious> via L<Mojo::Reactor::EV>
86  
87 =back
88  
89 =head1 AUTHOR
90  
91 DBIO Authors
92  
93 =head1 COPYRIGHT AND LICENSE
94  
95 Copyright (C) 2026 DBIO Authors
96  
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99  
100 =cut
« Async/TransactionContext.pm ↑ Summary