File Coverage

blib/lib/Iterator/Flex/Role/State/Closure.pm
Criterion Covered Total %
statement 32 32 100.0
branch 1 2 50.0
condition 2 2 100.0
subroutine 9 9 100.0
pod 2 2 100.0
total 46 47 97.8


line stmt bran cond sub pod time code
1             package Iterator::Flex::Role::State::Closure;
2              
3             # ABSTRACT: Iterator State is kept in a closure variable
4              
5 36     36   281428 use v5.28;
  36         142  
6 36     36   198 use strict;
  36         75  
  36         1027  
7 36     36   167 use warnings;
  36         66  
  36         3075  
8              
9             our $VERSION = '0.33';
10              
11 36     36   919 use Iterator::Flex::Utils qw( :default REG_ITERATOR REG_ITER_STATE :IterStates );
  36         65  
  36         6679  
12              
13 36     36   954 use Role::Tiny;
  36         8618  
  36         4395  
14 36     36   12508 use experimental 'signatures';
  36         249  
  36         308  
15              
16 36     36   8280 use namespace::clean;
  36         20178  
  36         404  
17              
18              
19              
20              
21              
22              
23              
24              
25              
26 906     906 1 1379 sub set_state ( $self, $state ) {
  906         1323  
  906         1396  
  906         1315  
27              
28 906         2896 ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] } = $state
29 906 50 100     1330 unless ( ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] } // IterState_CLEAR )
  906         4226  
30             == IterState_ERROR;
31             }
32              
33              
34              
35              
36              
37              
38              
39              
40              
41 1128     1128 1 1614 sub get_state ( $self ) {
  1128         1714  
  1128         1678  
42 1128         2157 ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] };
  1128         8992  
43             }
44              
45             with 'Iterator::Flex::Role::State';
46              
47             1;
48              
49             #
50             # This file is part of Iterator-Flex
51             #
52             # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.
53             #
54             # This is free software, licensed under:
55             #
56             # The GNU General Public License, Version 3, June 2007
57             #
58              
59             __END__