The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Egg::Request - Exclusive module of WEB request processing.

SYNOPSIS

 # Access from Egg to this object.
 $e->request  or $e->res;
 
 # get query.
 my $param= $request->params;
 my $foo= $param->{foo};
   or
 my $foo= $request->param('foo');
 
 # get cookie string.
 my $cookie= $request->cookie([COOKIE NAME]);
   or
 my $cookie= $request->cookies->{[COOKIE NAME]};
   and
 my $foge= $cookie->value;
 
 # get request path
 # * / enters the head without fail.
 my $path= $request->path;
 
 etc..

DESCRIPTION

Query parameters are united by the character-code set with $e->config->{character_in}.

If $e->config->{character_in} is undefined, it treats as 'euc'.

METHODS

$request->r;

Accessor to object for Request processing.

$request->parameters or $request->params;

Request query is returned by the HAHS reference.

$request->param([PARAM NAME]);

Request query is returned. does general operation.

$request->create_snip([PATH]);

It tries to make $e->snip.

example of dispatch.

 $e->request->create_snip( $e->request->param('path') );
 
 my $dir= $e->snip->[0] || return qw{ Root };
 
 ... ban, ban, ban.

$request->secure;

It becomes true at the request to SSL or Port 443.

$request->scheme;

Scheme of URL is returned. http or https

$request->path;

request path is returned. '/' enters the head without fail.

$request->cookie([COOKIE NAME]);

scalar object of cookie is restored.

In addition, when the value is taken out, value is used.

$request->cookies;

HASH reference of Cookie is returned.

$request->header([NAME]);

It moves like wrapper to the methods such as $request->uri and $request->user_agent.

It is scheduled to change to HTTP::Headers->header here.

$request->uri;

Request uri assembled by the URI module is returned.

$request->remote_addr or $request->address;

$ENV{REMOTE_ADDR} is returned.

$request->args;

$ENV{QUERY_STRING} is returned.

$request->user_agent or $request->agent;

$ENV{HTTP_USER_AGENT} is returned.

$request->protocol;

$ENV{SERVER_PROTOCOL} is returned.

$request->user;

$ENV{REMOTE_USER} is returned.

$request->method;

$ENV{REQUEST_METHOD} is returned.

$request->server_port or $request->port;

$ENV{SERVER_PORT} is returned.

$request->server_name;

$ENV{SERVER_NAME} is returned.

$request->request_uri;

$ENV{REQUEST_URI} is returned.

$request->path_info;

$ENV{PATH_INFO} is returned.

$request->https

$ENV{HTTPS} is returned.

$request->referer;

$ENV{HTTP_REFERER} is returned.

$request->accept_encoding;

$ENV{HTTP_ACCEPT_ENCODING} is returned.

$request->host;

$ENV{HTTP_HOST} or $ENV{SERVER_NAME} is returned.

$request->host_name;

Host name of the WEB server is returned.

$request->remote_host;

$ENV{REMOTE_HOST} is returned.

When hostname_lookup is off, acquisition is tried by gethostbyaddr().

SEE ALSO

CGI::Cookie, Egg::Response Egg::Release

AUTHOR

Masatoshi Mizuno, <mizuno@bomcity.com>

COPYRIGHT AND LICENSE

Copyright (C) 2006 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.