Romani/Connection.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 4 SCAR 20.1
CC
4
Cov
0%
new
12.0
disconnect
6.0
BEGIN
2.0
CRAP 7.4
1  
2 package DBIx::Romani::Connection;
3 use base qw(DBIx::Romani::Connection::Base);
4  
5 use strict;
6  
7 sub new
8 {
9 my $class = shift;
10 my $args = shift;
11  
12 my $dbh;
13 my $driver;
14 my $disconnect;
15
16 if ( ref($args) eq 'HASH' )
17 {
18 $driver = $args->{driver};
19 $dbh = $args->{dbh};
20 $disconnect = $args->{disconnect}
21 }
22 else
23 {
24 $driver = $args;
25 $dbh = shift;
26 }
27  
28 if ( not defined $disconnect )
29 {
30 $disconnect = 1;
31 }
32
33 my $self = $class->SUPER::new({ dbh => $dbh, driver => $driver });
34  
35 # store our disconnect state
36 $self->{disconnect} = $disconnect;
37  
38 bless $self, $class;
39 return $self;
40 }
41  
42 sub disconnect
43 {
44 my $self = shift;
45  
46 if ( $self->{disconnect} )
47 {
48 $self->SUPER::disconnect();
49 }
50  
51 $self->{dbh} = undef;
52 }
53  
54 1;
55