blib/lib/Net/Async/HTTP/StallTimer.pm

filter: Statementstmt 100% 21 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 96.5% 28 / 29 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Build ↑ Summary
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 -- leonerd@leonerd.org.uk
5  
6 package Net::Async::HTTP::StallTimer;
7  
8 37 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 37 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 37 ▶use base qw( IO::Async::Timer::Countdown );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 37 our $VERSION = '0.48';
13  
14 sub _init
15 {
16 4 ▶ my $self = shift;
Subroutine _init: called CC=1 SCAR=0.0
17 4 my ( $params ) = @_;
18 4 $self->SUPER::_init( $params );
19  
20 4 $self->{future} = delete $params->{future};
21 }
22  
23 14 ▶sub reason :lvalue { shift->{stall_reason} }
Subroutine reason: called CC=1 SCAR=0.0
Pod undocumented
24  
25 sub on_expire
26 {
27 4 ▶ my $self = shift;
Subroutine on_expire: called CC=1 SCAR=0.0
Pod documented
28  
29 4 my $conn = $self->parent;
30  
31 4 $self->{future}->fail( "Stalled while ${\$self->reason}", stall_timeout => );
32  
33 4 $conn->close_now;
34 }
35  
36 37 0x55AA;
« Build ↑ Summary