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   185547 use v5.28;
  36         109  
6 36     36   142 use strict;
  36         50  
  36         702  
7 36     36   114 use warnings;
  36         47  
  36         2179  
8              
9             our $VERSION = '0.34';
10              
11 36     36   521 use Iterator::Flex::Utils qw( :default REG_ITERATOR REG_ITER_STATE :IterStates );
  36         58  
  36         4679  
12              
13 36     36   579 use Role::Tiny;
  36         4700  
  36         255  
14 36     36   9084 use experimental 'signatures';
  36         134  
  36         231  
15              
16 36     36   5228 use namespace::clean;
  36         11658  
  36         323  
17              
18              
19              
20              
21              
22              
23              
24              
25              
26 933     933 1 1076 sub set_state ( $self, $state ) {
  933         998  
  933         1056  
  933         933  
27              
28 933         2128 ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] } = $state
29 933 50 100     978 unless ( ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] } // IterState_CLEAR )
  933         2951  
30             == IterState_ERROR;
31             }
32              
33              
34              
35              
36              
37              
38              
39              
40              
41 1135     1135 1 1147 sub get_state ( $self ) {
  1135         1166  
  1135         1126  
42 1135         1139 ${ $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_STATE] };
  1135         3402  
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__