blib/lib/Acme/MyPeek.pm

filter: Statementstmt 100% 60 / 60 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 7 totaltotal 89.8% 80 / 89 CC 8 SCAR 13.7
CC
8
Cov
97%
highval
8.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
↑ Summary
1 package Acme::MyPeek;
2 1 $Acme::MyPeek::VERSION = '0.07';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use B qw(svref_2object class);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Exporter;
9  
10 1 our @ISA = qw(Exporter);
11 1 our @EXPORT = qw(hi hd dt lv deb_hi deb_hd);
12 1 our @EXPORT_OK = qw();
13  
14 1 my $last_val;
15  
16 1 my $deb_hi_1 = '?';
17 1 my $deb_hi_2 = '?';
18 1 my $deb_hi_3 = '?';
19  
20 1 my $deb_hd_1 = '?';
21 1 my $deb_hd_2 = '?';
22 1 my $deb_hd_3 = '?';
23  
24 1 ▶sub deb_hi { ($deb_hi_1, $deb_hi_2, $deb_hi_3) }
Subroutine deb_hi: called CC=1 SCAR=0.0
Pod undocumented
25 1 ▶sub deb_hd { ($deb_hd_1, $deb_hd_2, $deb_hd_3) }
Subroutine deb_hd: called CC=1 SCAR=0.0
Pod undocumented
26  
27 126 ▶sub hi { highval( sub{
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine hi: called CC=1 SCAR=0.0
Pod undocumented
28 126 $deb_hi_1 = $_[0];
29 126 $deb_hi_2 = $_[0];
30 126 $deb_hi_3 = sprintf('%u', $_[0]);
31  
32 126 $deb_hi_2 eq $deb_hi_3;
33 1 }); }
34  
35 108 ▶sub hd { highval( sub{
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine hd: called CC=1 SCAR=0.0
Pod undocumented
36 108 $deb_hd_1 = $_[0];
37 108 $deb_hd_2 = sprintf('%.f', $_[0]);
38 108 $deb_hd_3 = sprintf('%.f', $_[0] - 1);
39  
40 108 $deb_hd_2 ne $deb_hd_3;
41 1 }); }
42  
43 3 ▶sub dt { class(svref_2object(\$_[0])); }
Subroutine dt: called CC=1 SCAR=0.0
Pod undocumented
44 2 ▶sub lv { $last_val; }
Subroutine lv: called CC=1 SCAR=0.0
Pod undocumented
45  
46 2 ▶sub highval {
Subroutine highval: called CC=8 SCAR=20.8
Pod undocumented
47 2 my ($ok) = @_;
48  
49 2 my $x = 1;
50 2 my $f = 1;
51  
52 2 for (1..100) {
53 36 my $y = $x * 10;
54  
55 36 ▶ unless ($ok->($y)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&$ok($y)) 2 34 36
56 2 $f = 0;
57 2 last;
58 }
59  
60 34 $x = $y;
61 }
62  
63 2 $last_val = $x;
64  
65 2 ▶ return -1 if $f;
Branch: 1 branch
BranchTrueFalseTotal
if $f 0 2 2
66  
67 2 my $r = $x;
68  
69 2 for (1..1000) {
70 198 my $y = $x + $r;
71  
72 198 ▶ unless ($ok->($y)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&$ok($y)) 36 162 198
73 36 ▶ if ($r <= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r <= 1) 2 34 36
74 2 $r = 0;
75 2 last;
76 }
77  
78 34 $r /= 10;
79 34 next;
80 }
81  
82 162 $x += $r;
83 }
84  
85 2 $last_val = $x;
86  
87 2 ▶ return -2 if $r;
Branch: 1 branch
BranchTrueFalseTotal
if $r 0 2 2
88  
89 2 return $x;
90 }
91  
92 1 1;
93  
94 __END__
↑ Summary