DBomb/Util.pm

filter: Statementstmt 81.2% 13 / 16 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 38.1% 16 / 42 CC 6 SCAR 28.0
CC
6
Cov
43%
is_same_value
30.0
ctx_0
6.0
BEGIN
1.0
CRAP 16.5
« DBomb/Value/Column.pm ↑ Summary DBomb/Query/Limit.pm »
1 package DBomb::Util;
2  
3 =head1 NAME
4  
5 DBomb::Util - Miscellany with no place else to go.
6  
7 =head1 SYNOPSIS
8  
9 =cut
10  
11 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 our $VERSION = '$Revision: 1.4 $';
14  
15 12 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 12 our %EXPORT_TAGS = ( all => [qw{
18 ctx_0 is_same_value
19 }]);
20 12 Exporter::export_ok_tags('all');
21  
22 ## returns @args if caller's caller is in list context, or $args[0] otherwise
23 ## ctx_0(@args)
24 sub ctx_0
25 0 ▶{
Subroutine ctx_0: not called CC=2 SCAR=17.9
Pod undocumented
26 0 ▶ (caller(1))[5] ? @_ : $_[0];
Branch: 1 branch
BranchTrueFalseTotal
(caller 1)[5] ? : 0 0 0
27 }
28  
29 ## like cmp but allows undef
30 sub is_same_value
31 0 ▶{
Subroutine is_same_value: not called CC=5 SCAR=34.0
Pod undocumented
32 0 my ($a,$b) = @_;
33 ## True if they are equal or if both undef
34 0 ▶ return ((defined($a) && defined($b) && $a eq $b)
Condition0%0/12
defined $a && defined $b && $a eq $b || !(defined $a || defined $b)
l!l&&r!l&&!r
000
defined $a and defined $b and $a eq $b
!ll&&!rl&&r
000
defined $a and defined $b
!ll&&!rl&&r
000
defined $a || defined $b
l!l&&r!l&&!r
000
MC/DC0%0/5
defined $a && defined $b && $a eq $b || !(defined $a || defined $b)
defined $a defined $b $a eq $b defined $a defined $b
Truth table0%0/10
A and B and C || not(D || E)
A= defined $aB= defined $bC= $a eq $bD= defined $aE= defined $b
ABCDEresult
111XX1
0XX001
10X001
110001
0XX1X0
0XX010
10X1X0
10X010
1101X0
110010
35 || (!defined($a) && !defined($b)));
36 }
37 12 1;
38 __END__
« DBomb/Value/Column.pm ↑ Summary DBomb/Query/Limit.pm »