File Coverage

blib/lib/Net/Async/HTTP/StallTimer.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 2 50.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2014-2023 -- leonerd@leonerd.org.uk
5              
6             package Net::Async::HTTP::StallTimer 0.49;
7              
8 40     40   485 use v5.14;
  40         132  
9 40     40   211 use warnings;
  40         86  
  40         1158  
10 40     40   213 use base qw( IO::Async::Timer::Countdown );
  40         78  
  40         17411  
11              
12             sub _init
13             {
14 4     4   74 my $self = shift;
15 4         8 my ( $params ) = @_;
16 4         18 $self->SUPER::_init( $params );
17              
18 4         23 $self->{future} = delete $params->{future};
19             }
20              
21 14     14 0 67 sub reason :lvalue { shift->{stall_reason} }
22              
23             sub on_expire
24             {
25 4     4 1 401686 my $self = shift;
26              
27 4         19 my $conn = $self->parent;
28              
29 4         26 $self->{future}->fail( "Stalled while ${\$self->reason}", stall_timeout => );
  4         16  
30              
31 4         600 $conn->close_now;
32             }
33              
34             0x55AA;