Storable.pm

filter: Statementstmt 100% 37 / 37 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 2 / 2 totaltotal 96.6% 57 / 59 CC 5 SCAR 5.6
CC
5
Cov
96%
save
3.0
STORE
3.0
BEGIN
1.0
CRAP 1.8
« DataDumper.pm ↑ Summary YAML.pm »
1 #
2 # $Id: Storable.pm,v 0.05 2020/08/05 18:26:03 dankogai Exp dankogai $
3 #
4 package Tie::Storable;
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base 'Tie::SaveLater';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our $VERSION = sprintf "%d.%02d", q$Revision: 0.05 $ =~ /(\d+)/g;
9 1 ▶use Storable ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 __PACKAGE__->make_subclasses;
12 5 ▶sub load{ Storable::retrieve($_[1]) };
Subroutine load: called CC=1 SCAR=0.0
Pod documented
13 8 ▶sub save{ Storable::nstore($_[0], $_[0]->filename) };
Subroutine save: called CC=1 SCAR=0.0
Pod documented
14  
15 ####
16 package Tie::Storable::More;
17 1 ▶use base 'Tie::SaveLater';
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 __PACKAGE__->make_subclasses;
20  
21 2 ▶sub load{
Subroutine load: called CC=1 SCAR=0.0
22 2 my ($class, $filename) = @_;
23 2 return Storable::retrieve($filename)
24 };
25  
26 2 ▶sub save{
Subroutine save: called CC=3 SCAR=11.0
27 2 my $self = shift;
28 2 ▶ if (my @options = $self->options){
Branch: 1 branch
BranchTrueFalseTotal
if (my(@options) = $self->options) 2 0 2
29 2 ▶ return 1 unless ($options[0] & 0222); # do nothing if read-only
Branch: 1 branch
BranchTrueFalseTotal
unless $options[0] & 146 1 1 2
30 }
31 1 return Storable::nstore($self, $self->filename)
32 };
33  
34 2 ▶sub STORE{
Subroutine STORE: called CC=3 SCAR=11.0
35 2 my $self = shift;
36 2 ▶ if (my @options = $self->options){
Branch: 1 branch
BranchTrueFalseTotal
if (my(@options) = $self->options) 2 0 2
37 2 ▶ croak "This variable is read-only!" unless ($options[0] & 0222);
Branch: 1 branch
BranchTrueFalseTotal
unless $options[0] & 146 1 1 2
38 }
39 1 return $self->super_super('STORE' => @_);
40 }
41  
42 1 1;
43 __END__
« DataDumper.pm ↑ Summary YAML.pm »