blib/lib/Iterator/Flex/Role/Next/Closure.pm

filter: Statementstmt 100% 31 / 31 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 91.4% 43 / 47 CC 2 SCAR 1.9
CC
2
Cov
94%
_construct_next
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Iterator/Flex/Role/Exhaustion/PassthroughThrow.pm ↑ Summary blib/lib/Iterator/Flex/Role/Wrap/Self.pm »
1 package Iterator::Flex::Role::Next::Closure;
2  
3 # ABSTRACT: Construct a next() method for iterators without closed over $self
4  
5 18 ▶use v5.28;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 18 our $VERSION = '0.33';
10  
11 18 ▶use Iterator::Flex::Utils 'NEXT';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 18 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 18 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 18 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 18 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31 ▶sub _construct_next ( $class, $ipar, $ ) {
Subroutine _construct_next: called CC=2 SCAR=7.6
32  
33 # ensure we don't hold any strong references in the subroutine
34 97 ▶ my $sub = $ipar->{ +NEXT } // throw_failure( parameter => q{Missing 'next' parameter} );
Condition33%1/3
$ipar->{"next"} // throw_failure("parameter", "Missing 'next' parameter")
l!l&&r!l&&!r
9700
MC/DC0%0/2
$ipar->{"next"} // throw_failure("parameter", "Missing 'next' parameter")
$ipar->{"next"} throw_failure("parameter", "Missing 'next' parameter")
Truth table33%1/3
A // B
A= $ipar->{"next"}B= throw_failure("parameter", "Missing 'next' parameter")
ABresult
1X1
011
000
35 97 Scalar::Util::weaken $ipar->{ +NEXT };
36 97 return $sub;
37 }
38  
39 554 ▶sub next ( $self ) { &{$self}() } ## no critic (BuiltinHomonyms)
Subroutine next: called CC=1 SCAR=0.0
Pod documented
40 18 *__next__ = \&next;
41  
42 18 1;
43  
44 #
45 # This file is part of Iterator-Flex
46 #
47 # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.
48 #
49 # This is free software, licensed under:
50 #
51 # The GNU General Public License, Version 3, June 2007
52 #
53  
54 __END__
« blib/lib/Iterator/Flex/Role/Exhaustion/PassthroughThrow.pm ↑ Summary blib/lib/Iterator/Flex/Role/Wrap/Self.pm »