Bulk/DBIC.pm

filter: Statementstmt 76.4% 13 / 17 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 70.8% 17 / 24 CC 2 SCAR 11.0
CC
2
Cov
68%
get_more
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Bulk/Array.pm ↑ Summary Bulk/Cat.pm »
1 package Data::Stream::Bulk::DBIC;
2 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 $Data::Stream::Bulk::DBIC::AUTHORITY = 'cpan:NUFFIN';
4 }
5 {
6 1 $Data::Stream::Bulk::DBIC::VERSION = '0.11';
7 }
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 # ABSTRACT: Iterate DBIC resultsets with L<Data::Stream::Bulk>
10  
11 1 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 with qw(Data::Stream::Bulk::DoneFlag) => { -excludes => [qw(is_done finished)] };
14  
15 1 has resultset => (
16 isa => "Object",
17 clearer => "finished",
18 handles => { next_row => "next" },
19 required => 1,
20 );
21  
22 0 ▶sub get_more {
Subroutine get_more: not called CC=2 SCAR=17.9
Pod documented
23 0 my $self = shift;
24  
25 0 ▶ if ( defined( my $next = $self->next_row ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $next = $self->next_row)) { } 0 0 0
26 0 return [ $next ];
27 } else {
28 0 return;
29 }
30 }
31  
32 1 __PACKAGE__->meta->make_immutable;
33  
34 1 __PACKAGE__;
35  
36  
37  
38 =pod
39  
40 =head1 NAME
41  
42 Data::Stream::Bulk::DBIC - Iterate DBIC resultsets with L<Data::Stream::Bulk>
43  
44 =head1 VERSION
45  
46 version 0.11
47  
48 =head1 SYNOPSIS
49  
50 Data::Stream::Bulk::DBIC->new(
51 resultset => scalar($schema->rs("Foo")->search(...))
52 );
53  
54 =head1 DESCRIPTION
55  
56 This is a wrapper for L<DBIx::Class::ResultSet> that fits the
57 L<Data::Stream::Bulk> api.
58  
59 Due to the fact that DBIC inflation overhead is fairly negligiable to that of
60 iteration though, I haven't actually bothered to make it bulk.
61  
62 If L<DBIx::Class::Cursor> will support n-at-a-time fetching as opposed to
63 one-at-a-time or all-at-a-time at some point in the future this class will be
64 updated to match.
65  
66 =head1 METHODS
67  
68 =over 4
69  
70 =item get_more
71  
72 See L<Data::Stream::Bulk::DoneFlag>.
73  
74 Returns a single row. In the future this should return more than one row.
75  
76 =back
77  
78 =head1 AUTHOR
79  
80 Yuval Kogman <nothingmuch@woobling.org>
81  
82 =head1 COPYRIGHT AND LICENSE
83  
84 This software is copyright (c) 2012 by Yuval Kogman.
85  
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88  
89 =cut
90  
91  
92 __END__
« Bulk/Array.pm ↑ Summary Bulk/Cat.pm »