File Coverage

blib/lib/Iterator/Flex/Role/Exhaustion/Throw.pm
Criterion Covered Total %
statement 31 31 100.0
branch 1 2 50.0
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 42 43 97.6


line stmt bran cond sub pod time code
1             package Iterator::Flex::Role::Exhaustion::Throw;
2              
3             # ABSTRACT: signal exhaustion by setting exhausted flag and throwing;
4              
5 17     17   350867 use v5.28;
  17         116  
6 17     17   93 use strict;
  17         34  
  17         425  
7 17     17   79 use warnings;
  17         35  
  17         1379  
8              
9             our $VERSION = '0.33';
10              
11 17     17   723 use Ref::Util;
  17         2908  
  17         992  
12 17     17   711 use Iterator::Flex::Utils qw( :default REG_GENERAL REG_GP_EXHAUSTION );
  17         37  
  17         3085  
13              
14 17     17   871 use Role::Tiny;
  17         11778  
  17         173  
15 17     17   6527 use experimental 'signatures';
  17         55  
  17         153  
16              
17 17     17   3789 use namespace::clean;
  17         18210  
  17         124  
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29 93     93 1 179 sub signal_exhaustion ( $self, @ ) {
  93         161  
  93         160  
30 93         377 $self->set_exhausted;
31              
32 93         284 my $exception = $REGISTRY{ refaddr $self }[REG_GENERAL][REG_GP_EXHAUSTION][1];
33              
34 93 50       265 $exception->() if Ref::Util::is_coderef( $exception );
35              
36 93         8157 require Iterator::Flex::Failure;
37 93         621 Iterator::Flex::Failure::Exhausted->throw;
38             }
39              
40              
41             1;
42              
43             #
44             # This file is part of Iterator-Flex
45             #
46             # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.
47             #
48             # This is free software, licensed under:
49             #
50             # The GNU General Public License, Version 3, June 2007
51             #
52              
53             __END__