| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PAGI::Context::HTTP; |
|
2
|
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
94
|
use strict; |
|
|
18
|
|
|
|
|
34
|
|
|
|
18
|
|
|
|
|
691
|
|
|
4
|
18
|
|
|
18
|
|
109
|
use warnings; |
|
|
18
|
|
|
|
|
21
|
|
|
|
18
|
|
|
|
|
5109
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our @ISA = ('PAGI::Context'); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
PAGI::Context::HTTP - HTTP-specific context subclass |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Returned by C<< PAGI::Context->new(...) >> when C<< $scope->{type} >> is |
|
15
|
|
|
|
|
|
|
C<'http'>. Adds lazy accessors for L and L, |
|
16
|
|
|
|
|
|
|
plus an HTTP C accessor. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Inherits all shared methods from L. |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 request |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $req = $ctx->request; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Returns a L instance. Lazy-constructed and cached. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 response |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $res = $ctx->response; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Returns a L instance. Lazy-constructed and cached. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 method |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $method = $ctx->method; # 'GET', 'POST', etc. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Returns the HTTP method from the scope. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 req |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $req = $ctx->req; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Alias for C. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 resp |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $res = $ctx->resp; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Alias for C. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub request { |
|
55
|
8
|
|
|
8
|
1
|
37
|
my ($self) = @_; |
|
56
|
8
|
|
66
|
|
|
37
|
return $self->{_request} //= do { |
|
57
|
6
|
|
|
|
|
2186
|
require PAGI::Request; |
|
58
|
6
|
|
|
|
|
59
|
PAGI::Request->new($self->{scope}, $self->{receive}); |
|
59
|
|
|
|
|
|
|
}; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub response { |
|
63
|
29
|
|
|
29
|
1
|
633
|
my ($self) = @_; |
|
64
|
29
|
|
66
|
|
|
103
|
return $self->{_response} //= do { |
|
65
|
27
|
|
|
|
|
4470
|
require PAGI::Response; |
|
66
|
27
|
|
|
|
|
168
|
PAGI::Response->new($self->{scope}, $self->{send}); |
|
67
|
|
|
|
|
|
|
}; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
8
|
|
|
8
|
1
|
57
|
sub method { shift->{scope}{method} } |
|
71
|
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
1
|
10
|
sub req { shift->request } |
|
73
|
1
|
|
|
1
|
1
|
50
|
sub resp { shift->response } |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |