Remember/YAML.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 50.0% 2 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 82.7% 48 / 58 CC 5 SCAR 6.4
CC
5
Cov
86%
new
3.3
load
2.0
dump
2.0
CRAP 1.9
« Remember/Memory.pm ↑ Summary Remember/DBM.pm »
1 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Data::Remember::YAML;
5 {
6 5 $Data::Remember::YAML::VERSION = '0.140490';
7 }
8 5 ▶use base qw/ Data::Remember::Memory /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 # ABSTRACT: a frozen memory brain plugin for Data::Remember
10  
11 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use YAML::Syck ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 5 ▶sub new {
Subroutine new: called CC=3 SCAR=11.8
Pod documented
16 5 my $class = shift;
17 5 my %args = @_;
18  
19 croak 'You must specify a "file" to load the data from.'
20 5 ▶ unless $args{file};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"file"} 0 5 5
21  
22 5 my $brain;
23 5 ▶ if (-f $args{file}) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $args{'file'}) { } 5 0 5
24 5 $brain = YAML::Syck::LoadFile($args{file});
25 }
26 else {
27 0 carp qq{Empty brain, "$args{file}" is not a file.};
28 0 $brain = {};
29 }
30  
31 bless {
32 brain => $brain,
33 file => $args{file},
34 5 }, $class;
35 }
36  
37  
38 2 ▶sub load {
Subroutine load: called CC=2 SCAR=7.0
Pod documented
39 2 my $self = shift;
40 2 ▶ my $file = shift || $self->{file};
Condition66%2/3
shift() || $self->{'file'}
l!l&&r!l&&!r
110
MC/DC0%0/2
shift() || $self->{'file'}
shift() $self->{'file'}
Truth table66%2/3
A || B
A= shift()B= $self->{'file'}
ABresult
1X1
011
000
41  
42 2 $self->{brain} = YAML::Syck::LoadFile($file);
43 }
44  
45  
46 2 ▶sub dump {
Subroutine dump: called CC=2 SCAR=7.0
Pod documented
47 2 my $self = shift;
48 2 ▶ my $file = shift || $self->{file};
Condition66%2/3
shift() || $self->{'file'}
l!l&&r!l&&!r
110
MC/DC0%0/2
shift() || $self->{'file'}
shift() $self->{'file'}
Truth table66%2/3
A || B
A= shift()B= $self->{'file'}
ABresult
1X1
011
000
49  
50 2 YAML::Syck::DumpFile($file, $self->{brain});
51 }
52  
53  
54 5 1;
55  
56 __END__
« Remember/Memory.pm ↑ Summary Remember/DBM.pm »