line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eve::HttpRequest; |
2
|
|
|
|
|
|
|
|
3
|
9
|
|
|
9
|
|
9769
|
use parent qw(Eve::Class); |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
62
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
508
|
use strict; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
257
|
|
6
|
9
|
|
|
9
|
|
50
|
use warnings; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
237
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
26414
|
use CGI (); |
|
9
|
|
|
|
|
123100
|
|
|
9
|
|
|
|
|
1751
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
B - an abstract HTTP request adapter. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Eve::HttpRequest; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $request = Eve::HttpRequest->new(); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $uri = $request->get_uri(); |
21
|
|
|
|
|
|
|
my $method = $request->get_method(); |
22
|
|
|
|
|
|
|
my $param = $request->get_parameter(name => 'some_parameter'); |
23
|
|
|
|
|
|
|
my @param_list = $request->get_parameter(name => 'some_list'); |
24
|
|
|
|
|
|
|
my $cookie = $request->get_cookie(name => 'some_cookie'); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The class defines all methods that any request adapter must implement |
29
|
|
|
|
|
|
|
in order to be used. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 B |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Returns an URI instance built from an HTTP request URI. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_uri { |
40
|
1
|
|
|
1
|
1
|
1298
|
Eve::Error::NotImplemented->throw(); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 B |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Returns an HTTP method name. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub get_method { |
50
|
1
|
|
|
1
|
1
|
2025
|
Eve::Error::NotImplemented->throw(); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 B |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns a request parameter value or a list of values for a specified |
56
|
|
|
|
|
|
|
parameter name. When called in a scalar context, will return a single |
57
|
|
|
|
|
|
|
value, which for a multivalue parameter will result in a first value |
58
|
|
|
|
|
|
|
of the list: |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $parameter_value = $request->get_parameter(name => 'some'); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
To receive a list of all values for a multivalue parameter, call the |
63
|
|
|
|
|
|
|
method in a list context: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my @parameter_value_list = $request->get_parameter(name => 'some'); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head3 Arguments |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over 4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item C |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=back |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_parameter { |
78
|
1
|
|
|
1
|
1
|
1646
|
Eve::Error::NotImplemented->throw(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 B |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Returns a hash reference with the requested parameter values. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub get_parameter_hash { |
88
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
my %result = $self->cgi->Vars(); |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
0
|
return \%result; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 B |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Returns a request cookie value for a specified name. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head3 Arguments |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item C |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub get_cookie { |
110
|
1
|
|
|
1
|
1
|
1773
|
Eve::Error::NotImplemented->throw(); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SEE ALSO |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over 4 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item C |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Copyright 2012 Igor Zinovyev. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
126
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
127
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHORS |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=over 4 |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item L |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |