Surveyor/DB_File.pm

filter: Statementstmt 68.0% 17 / 25 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 64.7% 22 / 34 CC 1 SCAR 3.4
CC
1
Cov
66%
STORE
2.0
FETCH
2.0
BEGIN
1.0
CRAP 1.4
« Surveyor/MakeCpan.pm ↑ Summary
1 package Dist::Surveyor::DB_File;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Storable qw(freeze thaw);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '0.023';
8  
9 3 our @ISA;
10 0 ▶if (eval { require DB_File; 1; }) {
Branch: 2 branches
BranchTrueFalseTotal
if (eval { do { require DB_File; 1 } }) { } 0 3 3
elsif (eval { do { require SDBM_File; 1 } }) { } 3 0 3
11 0 @ISA = ('DB_File');
12  
13 }
14 3 elsif (eval { require SDBM_File; 1; }) {
15 3 @ISA = ('SDBM_File');
16 }
17 else {
18 0 die "Need either DB_file or SDBM_File installed to run";
19 }
20  
21 # DB_File can store only strings as values, and not Perl structures
22 # this small wrapper fixes the problem
23  
24 0 ▶sub STORE {
Subroutine STORE: not called CC=1 SCAR=6.9
25 0 my ($self, $key, $val) = @_;
26 0 $self->SUPER::STORE($key, freeze($val));
27 }
28  
29 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
30 0 my ($self, $key) = @_;
31 0 my $val = $self->SUPER::FETCH($key);
32 0 return thaw($val);
33 }
34  
35 3 return 1;
« Surveyor/MakeCpan.pm ↑ Summary