File Coverage

blib/lib/Brackup/InventoryDatabase.pm
Criterion Covered Total %
statement 24 25 96.0
branch n/a
condition 2 2 100.0
subroutine 10 11 90.9
pod 0 7 0.0
total 36 45 80.0


line stmt bran cond sub pod time code
1             package Brackup::InventoryDatabase;
2 13     13   72 use strict;
  13         27  
  13         413  
3 13     13   7941 use Brackup::Dict::SQLite;
  13         46  
  13         445  
4 13     13   161 use warnings;
  13         35  
  13         523  
5 13     13   79 use Carp qw(croak);
  13         34  
  13         4141  
6              
7             sub new {
8 7     7 0 22 my ($class, $file, $tconf) = @_;
9 7         50 my $self = bless {}, $class;
10              
11 7   100     35 my $type = $tconf->value('inventorydb_type') || 'SQLite';
12              
13 7         73 my $dict_class = "Brackup::Dict::$type";
14 7         534 eval "require $dict_class";
15 7         209 $self->{dict} = $dict_class->new(table => "target_inv", file => $file);
16              
17 7         97 return $self;
18             }
19              
20             # proxy through to underlying dictionary
21 144     144 0 1876 sub get { shift->{dict}->get(@_) }
22 81     81 0 1075 sub set { shift->{dict}->set(@_) }
23 145     145 0 1477 sub each { shift->{dict}->each(@_) }
24 3     3 0 17 sub delete { shift->{dict}->delete(@_) }
25 0     0 0 0 sub count { shift->{dict}->count(@_) }
26 18     18 0 119 sub backing_file { shift->{dict}->backing_file(@_) }
27              
28              
29             1;
30             __END__