blib/lib/DBM/Deep/Null.pm

filter: Statementstmt 81.8% 18 / 22 Branchbran 25.0% 1 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 72.7% 8 / 11 Podpod n/a totaltotal 66.6% 28 / 42 CC 4 SCAR 12.3
CC
4
Cov
69%
__ANON__
8.7
__ANON__
2.0
__ANON__
2.0
CRAP 3.4
« blib/lib/DBM/Deep/Sector/File/Index.pm ↑ Summary blib/lib/DBM/Deep/Iterator/DBI.pm »
1 package DBM::Deep::Null;
2  
3 53 ▶use 5.008_004;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 53 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 53 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 DBM::Deep::Null - NULL object
11  
12 =head1 PURPOSE
13  
14 This is an internal-use-only object for L<DBM::Deep>. It acts as a NULL object
15 in the same vein as MARCEL's L<Class::Null>. I couldn't use L<Class::Null>
16 because DBM::Deep needed an object that always evaluated as undef, not an
17 implementation of the Null Class pattern.
18  
19 =head1 OVERVIEW
20  
21 It is used to represent null sectors in DBM::Deep.
22  
23 =cut
24  
25 use overload
26 0 ▶ 'bool' => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
27 0 ▶ '""' => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 0 ▶ '0+' => sub { 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 ('cmp' =>
30 '<=>' => sub {
31 2 ▶ return 0 if !defined $_[1] || !length $_[1];
Subroutine __ANON__: called CC=4 SCAR=21.7
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] and length $_[1] 2 0 2
Condition33%1/3
defined $_[1] and length $_[1]
!ll&&!rl&&r
200
MC/DC0%0/2
defined $_[1] and length $_[1]
defined $_[1] length $_[1]
Truth table33%1/3
A and B
A= defined $_[1]B= length $_[1]
ABresult
0X0
100
111
32 0 ▶ return $_[2] ? 1 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$_[2] ? : 0 0 0
33 }
34 )[0,2,1,2], # same sub for both ops
35 '%{}' => sub {
36 1 ▶ require Carp;
Subroutine __ANON__: called CC=1 SCAR=0.0
37 1 Carp::croak("Can't use a stale reference as a HASH");
38 },
39 '@{}' => sub {
40 1 ▶ require Carp;
Subroutine __ANON__: called CC=1 SCAR=0.0
41 1 Carp::croak("Can't use a stale reference as an ARRAY");
42 },
43 53 fallback => 1,
44 53 ▶ nomethod => 'AUTOLOAD';
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 2 ▶sub AUTOLOAD { return; }
Subroutine AUTOLOAD: called CC=1 SCAR=0.0
47  
48 53 1;
49 __END__
« blib/lib/DBM/Deep/Sector/File/Index.pm ↑ Summary blib/lib/DBM/Deep/Iterator/DBI.pm »