File Coverage

blib/lib/Embedix/DB.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 2 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 30 56.6


line stmt bran cond sub pod time code
1             package Embedix::DB;
2              
3 2     2   24296 use strict;
  2         4  
  2         101  
4 2     2   12 use vars qw($VERSION $AUTOLOAD);
  2         4  
  2         123  
5              
6             # this class is central all things configuration-related
7 2     2   2940 use Embedix::ECD;
  2         306900  
  2         71  
8              
9             # database back ends
10 2     2   1600 use Embedix::DB::Pg;
  2         7  
  2         290  
11             #se Embedix::DB::mysql;
12              
13             $VERSION = 0.05;
14              
15             # Embedix::DB->new (
16             # backend => 'Pg' # only one implemented so far
17             # source => [ 'dbi:Pg:dbname=embedix', $user, $password, $opt ],
18             # );
19             #
20             # factory method for Embedix::DB::* objects
21             #_______________________________________
22             sub new {
23 0     0 1   my $proto = shift;
24 0   0       my $class = ref($proto) || $proto;
25 0 0         (@_ & 1) && die("Odd number of parameters.");
26 0           my %opt = @_;
27              
28             # FIXME : this needs to be much more robust
29              
30 0           my $edb_class = "Embedix::DB::" . $opt{backend};
31              
32 0           my $self = $edb_class->new(source => $opt{source});
33              
34 0           return $self;
35             }
36              
37              
38             1;
39              
40             __END__