| 1 | package Dancer2::Core::Response::Delayed; | ||||||||||
| 2 | # ABSTRACT: Delayed responses | ||||||||||
| 3 | 164 | $Dancer2::Core::Response::Delayed::VERSION = '2.3.0'; | |||||||||
| 4 | 164 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 164 | ▶ | use Dancer2::Core::Types qw<CodeRef InstanceOf>; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 164 | has request => ( | |||||||||
| 8 | is => 'ro', | ||||||||||
| 9 | isa => InstanceOf['Dancer2::Core::Request'], | ||||||||||
| 10 | required => 1, | ||||||||||
| 11 | ); | ||||||||||
| 12 | |||||||||||
| 13 | 164 | has response => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | isa => InstanceOf['Dancer2::Core::Response'], | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | handles => [qw/status headers push_header/], | ||||||||||
| 18 | ); | ||||||||||
| 19 | |||||||||||
| 20 | 164 | has cb => ( | |||||||||
| 21 | is => 'ro', | ||||||||||
| 22 | isa => CodeRef, | ||||||||||
| 23 | required => 1, | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 164 | has error_cb => ( | |||||||||
| 27 | is => 'ro', | ||||||||||
| 28 | isa => CodeRef, | ||||||||||
| 29 | predicate => '_has_error_cb', | ||||||||||
| 30 | ); | ||||||||||
| 31 | |||||||||||
| 32 | sub is_halted() {0} | ||||||||||
| 33 | sub has_passed() {0} | ||||||||||
| 34 | |||||||||||
| 35 | 27 | ▶ | sub to_psgi { | ||||||||
|
Subroutine
to_psgi: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 36 | 27 | my $self = shift; | |||||||||
| 37 | |||||||||||
| 38 | 27 | ▶ | return sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 39 | 27 | my $responder = shift; | |||||||||
| 40 | |||||||||||
| 41 | 27 | local $Dancer2::Core::Route::REQUEST = $self->request; | |||||||||
| 42 | 27 | local $Dancer2::Core::Route::RESPONSE = $self->response; | |||||||||
| 43 | 27 | local $Dancer2::Core::Route::RESPONDER = $responder; | |||||||||
| 44 | 27 | local $Dancer2::Core::Route::WRITER; | |||||||||
| 45 | |||||||||||
| 46 | 27 | ▶ | local $Dancer2::Core::Route::ERROR_HANDLER = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | $self->_has_error_cb ? $self->error_cb : undef; | ||||||||||
| 48 | |||||||||||
| 49 | 27 | $self->cb->(); | |||||||||
| 50 | 27 | }; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 164 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||