| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PAGI::Utils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
161701
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
30
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
41
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use Exporter 'import'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use Future::AsyncAwait; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
7
|
1
|
|
|
1
|
|
103
|
use Carp qw(croak); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
41
|
|
|
8
|
1
|
|
|
1
|
|
302
|
use PAGI::Lifespan; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
272
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(handle_lifespan); |
|
11
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT_OK); |
|
12
|
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
1
|
185350
|
async sub handle_lifespan { |
|
14
|
6
|
|
|
|
|
11
|
my ($scope, $receive, $send, %opts) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
6
|
|
50
|
|
|
15
|
my $type = $scope->{type} // ''; |
|
17
|
6
|
100
|
|
|
|
166
|
croak "handle_lifespan called with scope type '$type' (expected 'lifespan'). " |
|
18
|
|
|
|
|
|
|
. "Check scope type before calling: " |
|
19
|
|
|
|
|
|
|
. "return await handle_lifespan(...) if \$scope->{type} eq 'lifespan'" |
|
20
|
|
|
|
|
|
|
unless $type eq 'lifespan'; |
|
21
|
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
20
|
my $manager = PAGI::Lifespan->for_scope($scope); |
|
23
|
5
|
100
|
66
|
|
|
21
|
$manager->register(%opts) if $opts{startup} || $opts{shutdown}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
5
|
|
|
|
|
13
|
return await $manager->handle($scope, $receive, $send); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |