Egg::Request - HTTP request processing for Egg.
# The request object is obtained. my $req= $e->request; # The query data is acquired. my $foo= $req->param('foo'); or my $foo= $req->params->{foo}; # Cookie is acquired. my $baa= $req->cookie('baa')->value; or my $baa= $req->cookie_value('baa'); # The request passing is acquired. my $path= $req->path; # ...etc.
This module offers processing and the function that relates to the HTTP request.
Depth of directory that can be requested.
# If it is 'max_snip_deep = 3', the following request becomes Forbidden. http://foo.tld/baa/zuu/hoge/bad_content
Option to set or to pass to main body for request.
DISABLE_UPLOADS
The file upload is invalidated.
* Please refer to 'Egg::Plugin::Upload' for the file upload.
TEMP_DIR
Work folder for file upload chiefly
POST_MAX
Maximum of standard input accepted when request method is POST.
The object that actually does the request processing is returned.
For instance, if it is Apache::Request, and usual CGI if it is operating by mod_perl, the object of CGI is restored.
$request-E<gt>r->param;
* The method that can be used depends on the module of the object because it is a direct call.
The request passing is returned.
* There is a thing different from 'PATH_INFO' of the environment variable because returned information is processed to process it with Egg.
When the request method is GET, ture is restored.
When the request method is POST, true is restored.
When the request method is HEAD, true is restored.
Refer to 'HTTP_USER_AGENT' of the environment variable.
Alias: agent, user_agent
Refer to 'SERVER_PROTOCOL' of the environment variable.
Alias: protocol
Refer to 'REMOTE_USER' of the environment variable.
Alias: user
Refer to 'SCRIPT_NAME' of the environment variable.
Refer to 'REQUEST_URI' of the environment variable.
* A value different from the uri method might return.
Refer to 'PATH_INFO' of the environment variable.
Refer to 'HTTP_REFERER' of the environment variable.
Alias: referer
Refer to 'HTTP_ACCEPT_ENCODING' of the environment variable.
Alias: accept_encoding
Refer to 'REMOTE_ADDR' of the environment variable.
Alias: addr, address
Default is '127.0.0.1'.
Refer to 'REQUEST_METHOD' of the environment variable.
Alias: method
Default is 'GET'.
Refer to 'SERVER_NAME' of the environment variable.
Default is 'localhost'.
Refer to 'SERVER_SOFTWARE' of the environment variable.
Default is 'cmdline'.
Refer to 'SERVER_PORT' of the environment variable.
Alias: port
Default is '80'.
The version of the mod_perl is returned if it operates by mod_perl.
Constructor. When the project is usually started, this is called. It is not necessary to call it specifying it.
The ARRAY reference for which $request->path is resolved by '/' delimitation is returned.
* The depth of passing that can be requested by 'max_snip_deep' of configuration can be setup. Default is undefined.
The request query is returned by the HASH reference.
Alias: params
while (my($key, $value)= each %{$request->params}) { print "$key = $value \n"; }
When the argument is omitted, the key list of the request query is returned with ARRAY.
When KEY is specified, the value of the corresponding request query is returned.
When both KEY and VALUE are given, the value is set.
my $value= $request->param('param_name'); $request->param( in_param => 'in_value' );
Cookie corresponding to KEY is returned.
Because it is an object that is returned that CGI::Cookie returns, it is necessary to use the value method to refer to the value in addition. see CGI::Cookie,
my $cookie= $request->cookie('get_param'); my $value = $cookie->value;
Fetch of "CGI::Cookie " is returned. * It is HASH reference that returns.
my $cookies = $request->cookies; while (my($key, $cookie)= each %$cookies) { print "$key = ". $cookie->value ."\n"; }
Caene of the value method of Cookie corresponding to KEY is returned. $request->cookie([KEY])->value is done in a word at a time.
my $value= $request->cookie_value('cookie_name');
True is returned concluding that the SSL communication is done when HTTPS of the environment variable is effective or 'SERVER_PORT' is 443.
If $request->secure is true, 'Https' is returned though 'Http' returns usually.
The result of assembling URI based on $request->path is returned.
Alias: url
If environment variable 'REMOTE_HOST' is obtained, the value is returned. If it is not good, gethostbyaddr is called and acquisition is tried. Finally, $request->remote_addr is returned.
As for the value that $request->host returns, the port number is sometimes included. This method returns the host name that doesn't contain the port number without fail.
'HTTP_HOST' of the environment variable or 'SERVER_NAME' is returned.
Default is 'localhost',
The value of 'QUERY_STRING' of the environment variable or 'REDIRECT_QUERY_STRING' is returned.
It is an accessor to the Egg::Response object.
CGI::Cookie, Egg::Request::CGI Egg::Request::FastCGI Egg::Response, Egg::Release,
Masatoshi Mizuno <lushe@cpan.org>
Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
1 POD Error
The following errors were encountered while parsing the POD:
L<> starts or ends with whitespace
To install Egg::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Release
CPAN shell
perl -MCPAN -e shell install Egg::Release
For more information on module installation, please visit the detailed CPAN module installation guide.