File Coverage

blib/lib/Brackup/DigestCache.pm
Criterion Covered Total %
statement 17 21 80.9
branch n/a
condition 2 5 40.0
subroutine 6 10 60.0
pod 0 8 0.0
total 25 44 56.8


line stmt bran cond sub pod time code
1             package Brackup::DigestCache;
2 13     13   71 use strict;
  13         30  
  13         408  
3 13     13   71 use warnings;
  13         25  
  13         5085  
4              
5             sub new {
6 8     8 0 23 my ($class, $root, $rconf) = @_;
7 8         96 my $self = bless {}, $class;
8              
9 8   33     43 my $file = $rconf->value('digestdb_file') ||
10             ($root->path . '/' . default_filename());
11 8   50     34 my $type = $rconf->value('digestdb_type') || 'SQLite';
12              
13 8         29 my $dict_class = "Brackup::Dict::$type";
14 8         1437 eval "require $dict_class";
15 8         127 $self->{dict} = $dict_class->new(
16             table => "digest_cache",
17             file => $file,
18             );
19              
20 8         145 return $self;
21             }
22              
23 0     0 0 0 sub default_filename { ".brackup-digest.db" };
24              
25             # proxy through to underlying dictionary
26 178     178 0 10604 sub get { shift->{dict}->get(@_) }
27 97     97 0 551 sub set { shift->{dict}->set(@_) }
28 0     0 0 0 sub each { shift->{dict}->each(@_) }
29 0     0 0 0 sub delete { shift->{dict}->delete(@_) }
30 0     0 0 0 sub count { shift->{dict}->count(@_) }
31 8     8 0 72 sub backing_file { shift->{dict}->backing_file(@_) }
32              
33             1;
34              
35             __END__