Eve/HttpRequest.pm

filter: Statementstmt 85.0% 17 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 5 / 5 totaltotal 88.2% 30 / 34 CC 1 SCAR 1.1
CC
1
Cov
85%
get_parameter_hash
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Eve/EventHandler.pm ↑ Summary Eve/PsgiStub.pm »
1 package Eve::HttpRequest;
2  
3 10 ▶use parent qw(Eve::Class);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use CGI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 NAME
11  
12 B<Eve::HttpRequest> - 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<get_uri>
34  
35 Returns an URI instance built from an HTTP request URI.
36  
37 =cut
38  
39 1 ▶sub get_uri {
Subroutine get_uri: called CC=1 SCAR=0.0
Pod documented
40 1 Eve::Error::NotImplemented->throw();
41 }
42  
43 =head2 B<get_method>
44  
45 Returns an HTTP method name.
46  
47 =cut
48  
49 1 ▶sub get_method {
Subroutine get_method: called CC=1 SCAR=0.0
Pod documented
50 1 Eve::Error::NotImplemented->throw();
51 }
52  
53 =head2 B<get_parameter()>
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<name>
72  
73 =back
74  
75 =cut
76  
77 1 ▶sub get_parameter {
Subroutine get_parameter: called CC=1 SCAR=0.0
Pod documented
78 1 Eve::Error::NotImplemented->throw();
79 }
80  
81 =head2 B<get_parameter_hash()>
82  
83 Returns a hash reference with the requested parameter values.
84  
85 =cut
86  
87 0 ▶sub get_parameter_hash {
Subroutine get_parameter_hash: not called CC=1 SCAR=6.9
Pod documented
88 0 my $self = shift;
89  
90 0 my %result = $self->cgi->Vars();
91  
92 0 return \%result;
93 }
94  
95 =head2 B<get_cookie()>
96  
97 Returns a request cookie value for a specified name.
98  
99 =head3 Arguments
100  
101 =over 4
102  
103 =item C<name>
104  
105 =back
106  
107 =cut
108  
109 1 ▶sub get_cookie {
Subroutine get_cookie: called CC=1 SCAR=0.0
Pod documented
110 1 Eve::Error::NotImplemented->throw();
111 }
112  
113 =head1 SEE ALSO
114  
115 =over 4
116  
117 =item C<Eve::Class>
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<Igor Zinovyev|mailto:zinigor@gmail.com>
137  
138 =cut
139  
140 10 1;
« Eve/EventHandler.pm ↑ Summary Eve/PsgiStub.pm »