blib/lib/Loop/Control.pm

filter: Statementstmt 60.6% 20 / 33 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 60.0% 30 / 50 CC 3 SCAR 10.1
CC
3
Cov
54%
callstack_depth
6.0
FIRST
6.0
__ANON__
2.0
CRAP 2.8
↑ Summary
1 3 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Loop::Control;
6 3 our $VERSION = '1.100861';
7 # ABSTRACT: FIRST and NEXT functions for loops
8 3 ▶use Scope::Upper qw(reap :words);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 our @EXPORT = qw(FIRST NEXT);
11  
12 0 ▶sub callstack_depth {
Subroutine callstack_depth: not called CC=2 SCAR=17.9
Pod documented
13 0 my $depth = 0;
14 0 ▶ while (caller($depth)) { $depth++ }
Branch: 1 branch
BranchTrueFalseTotal
if (caller $depth) 0 0 0
15 0 $depth;
16 }
17  
18 0 ▶sub FIRST (&) {
Subroutine FIRST: not called CC=2 SCAR=17.9
Pod documented
19 0 my $code = shift;
20 0 my ($package, $filename, $line) = caller;
21 0 my $callstack_depth = callstack_depth();
22 0 my $key = "FIRST $package $filename $line $callstack_depth";
23 0 our %seen;
24 0 ▶ unless ($seen{$key}++) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($Loop::Control::seen{$key}++) 0 0 0
25 0 $code->();
26 }
27 0 ▶ reap sub { delete $seen{$key} } => UP UP;
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 }
29  
30 16 ▶sub NEXT (&) {
Subroutine NEXT: called CC=1 SCAR=0.0
Pod documented
31 16 my $code = shift;
32 16 ▶ reap sub { $code->() } => UP;
Subroutine __ANON__: called CC=1 SCAR=0.0
33 }
34 3 1;
35  
36  
37 __END__
↑ Summary