| 1 | package Net::HTTP2::PartialResponse; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =encoding utf-8 | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Net::HTTP2::PartialResponse - Partial HTTP/2 Response | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | This class represents a partial (i.e., in-progress) HTTP/2 response. | ||
| 15 | It extends L<Net::HTTP2::Response> with a control to cancel the | ||
| 16 | request. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | #---------------------------------------------------------------------- | ||
| 21 | |||
| 22 | 1 | ▶ | use parent 'Net::HTTP2::Response'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 1 | my %CANCEL_SR; | |
| 25 | |||
| 26 | #---------------------------------------------------------------------- | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | # Not called publicly. | ||
| 33 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 34 | 0 | my ($class, $sr) = splice @_, 0, 2; | |
| 35 | 0 | my $self = $class->SUPER::new(@_); | |
| 36 | 0 | $CANCEL_SR{ $self } = $sr; | |
| 37 | 0 | return $self; | |
| 38 | } | ||
| 39 | |||
| 40 | =head2 I<OBJ>->cancel() | ||
| 41 | |||
| 42 | Call this to cancel the in-progress request that I<OBJ> represents. | ||
| 43 | |||
| 44 | =cut | ||
| 45 | |||
| 46 | 0 | ▶ | sub cancel { |
|
Subroutine
cancel: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 47 | 0 | ${ $CANCEL_SR{$_[0]} } = 1; | |
| 48 | } | ||
| 49 | |||
| 50 | 0 | ▶ | sub DESTROY { |
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||
| 51 | 0 | delete $CANCEL_SR{ $_[0] }; | |
| 52 | } | ||
| 53 | |||
| 54 | 1 | 1; | |