File Coverage

blib/lib/Alzabo/Runtime/Cursor.pm
Criterion Covered Total %
statement 9 24 37.5
branch 0 4 0.0
condition n/a
subroutine 3 10 30.0
pod 5 6 83.3
total 17 44 38.6


line stmt bran cond sub pod time code
1             package Alzabo::Runtime::Cursor;
2              
3 11     11   71 use strict;
  11         26  
  11         611  
4 11     11   61 use vars qw($VERSION);
  11         21  
  11         415  
5              
6 11     11   59 use Alzabo::Runtime;
  11         22  
  11         3847  
7              
8             $VERSION = 2.0;
9              
10             1;
11              
12             sub new
13             {
14 0     0 1   shift->_virtual;
15             }
16              
17             sub next
18             {
19 0     0 0   shift->_virtual;
20             }
21              
22             sub all_rows
23             {
24 0     0 1   shift->_virtual;
25             }
26              
27             sub _virtual
28             {
29 0     0     my $self = shift;
30              
31 0           my $sub = (caller(1))[3];
32 0           Alzabo::Exception::VirtualMethod->throw
33             ( error =>
34             "$sub is a virtual method and must be subclassed in " . ref $self );
35             }
36              
37             sub reset
38             {
39 0     0 1   my $self = shift;
40              
41 0           $self->{statement}->execute( $self->{statement}->bind );
42              
43 0           $self->{count} = 0;
44             }
45              
46             sub count
47             {
48 0     0 1   my $self = shift;
49              
50 0           return $self->{count};
51             }
52              
53             sub next_as_hash
54             {
55 0     0 1   my $self = shift;
56              
57 0 0         my @next = $self->next or return;
58              
59 0 0         return map { defined $_ ? ( $_->table->name => $_ ) : () } @next;
  0            
60             }
61              
62             __END__