File Coverage

blib/lib/Iterator/Flex/Role/Exhaustion/Return.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 2 2 100.0
total 44 44 100.0


line stmt bran cond sub pod time code
1             package Iterator::Flex::Role::Exhaustion::Return;
2              
3             # ABSTRACT: signal exhaustion by returning a sentinel value.
4              
5 30     30   184192 use v5.28;
  30         117  
6 30     30   114 use strict;
  30         47  
  30         518  
7 30     30   89 use warnings;
  30         48  
  30         1528  
8              
9             our $VERSION = '0.34';
10              
11 30     30   124 use Scalar::Util();
  30         45  
  30         547  
12 30     30   413 use Iterator::Flex::Utils qw[ :default REG_GENERAL REG_GP_EXHAUSTION ];
  30         46  
  30         3411  
13 30     30   554 use Role::Tiny;
  30         4497  
  30         199  
14 30     30   5954 use experimental 'signatures';
  30         91  
  30         133  
15              
16 30     30   4014 use namespace::clean;
  30         11039  
  30         155  
17              
18              
19              
20              
21              
22              
23              
24              
25              
26 472     472 1 570 sub sentinel ( $self ) {
  472         521  
  472         516  
27 472         1613 return $REGISTRY{ refaddr $self }[REG_GENERAL][REG_GP_EXHAUSTION][1];
28             }
29              
30              
31              
32              
33              
34              
35              
36              
37              
38              
39 471     471 1 605 sub signal_exhaustion ( $self, @ ) {
  471         547  
  471         514  
40 471         1337 $self->set_exhausted;
41 471         841 return $self->sentinel;
42             }
43              
44              
45             1;
46              
47             #
48             # This file is part of Iterator-Flex
49             #
50             # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.
51             #
52             # This is free software, licensed under:
53             #
54             # The GNU General Public License, Version 3, June 2007
55             #
56              
57             __END__