blib/lib/Oryx/DBM/Util.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 31 CC 2 SCAR 11.5
CC
2
Cov
0%
table_drop
6.0
new
2.0
table_exists
2.0
CRAP 3.1
1 package Oryx::DBM::Util;
2  
3 use File::Spec;
4 use DBM::Deep;
5  
6 sub new {
7 my $class = shift;
8 return bless { }, $class;
9 }
10  
11 sub table_exists {
12 my ($self, $dbm, $table) = @_;
13 return -e File::Spec->catfile($dbm->datapath, $table);
14 }
15  
16 sub table_create {
17 my ($self, $dbm, $table) = @_;
18 my $filename = File::Spec->catfile($dbm->datapath, $table);
19 $dbm->catalog->put( $table, {
20 file => $filename,
21 type => DBM::Deep::TYPE_ARRAY,
22 autoflush => 1,
23 locking => 1,
24 });
25 }
26  
27 sub table_drop {
28 my ($self, $dbm, $table) = @_;
29 my $meta = $dbm->catalog->get( $table );
30 return unless $meta; # not defined for link tables
31 unlink $meta->{file};
32 $dbm->catalog->delete( $table );
33 }
34  
35 1;
36 __END__