Che/Results.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 39 CC 2 SCAR 12.0
CC
2
Cov
0%
do
6.0
fetchcol_arrayref
2.0
BEGIN
2.0
CRAP 3.3
1 package Mojo::Pg::Che::Results;
2  
3 use Mojo::Base 'Mojo::Pg::Results';
4  
5 my $PKG = __PACKAGE__;
6  
7 sub fetchcol_arrayref {
8 my $self = shift;
9 my ($columns, $maxrows) = @_;
10 $columns ||= [0];
11 map $columns->[$_]--, 0..$#$columns;
12 [map @$_, @{$self->sth->fetchall_arrayref($columns, $maxrows)}];
13 }
14  
15 sub do {
16 my $self = shift;
17 my $rows = $self->sth->rows;
18 ($rows == -1) ? "0E0" : $rows; # always return true if no error
19 }
20  
21 my @STH_METHODS = qw(
22 fetchrow_arrayref
23 fetchrow_array
24 fetchrow_hashref
25 fetchall_arrayref
26 fetchall_hashref
27 );
28  
29 for my $method (@STH_METHODS) {
30 no strict 'refs';
31 no warnings 'redefine';
32 *{"${PKG}::$method"} = sub {
33 my $self = shift;
34 my $sth = $self->sth;
35 return $sth->$method(@_);
36 };
37
38 }
39  
40 #~ our $AUTOLOAD;
41 #~ sub AUTOLOAD {
42 #~ my ($method) = $AUTOLOAD =~ /([^:]+)$/;
43 #~ my $self = shift;
44 #~ my $sth = $self->sth;
45
46 #~ if ($sth->can($method) && scalar grep $_ eq $method, @STH_METHODS) {
47 #~ return $sth->$method(@_);
48 #~ }
49
50 #~ die sprintf qq{Can't locate autoloaded object method "%s" (%s) via package "%s" at %s line %s.\n}, $method, $AUTOLOAD, ref $self, (caller)[1,2];
51
52 #~ }
53  
54 1;