Konstrukt::Request - Class for everything related to the page request
#set/get request method $Konstrukt::Request->method('GET'); my $m = $Konstrukt::Request->method(); #set/get requested uri $Konstrukt::Request->uri('/foo'); my $u = $Konstrukt::Request->uri(); #set/get header $Konstrukt::Request->header('Content-Type' => 'text/html'); my $c = $Konstrukt::Request->header('Content-Type'); #all heades as hash ref my $h = $Konstrukt::Response->headers();
This object will provide access to the request, which is currently processed. Usually you will only retrieve data from the request, but you may also set it.
To set response parameters you should use Konstrukt::Response.
It's similar to HTTP::Request but without some methods, that are not needed here.
Parameters:
To initialize the request object you can specify these optional keys:
my $r = Konstrukt::Request->new( uri => '/foo', method => 'GET', headers => { Accept => 'text/html' } );
Returns the current URI. If the URI parameter is defined, the current URI will be overwritten.
$uri - Optional: When defined, this URI will replace the current URI
Returns the current method. If the method parameter is defined, the current method will be overwritten.
$method - Optional: When defined, this method will replace the current method
Returns the value of the requested header field or undef, if no such header field exists. If the value parameter is defined, the current value for the specified header field will be overwritten.
$field - The header field
$value - Optional: When defined, this value will replace the current value for the specified header field
Returns a hash reference containing all set header fields and the appropriate values.
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.
Konstrukt::Response, Konstrukt::Handler
To install Konstrukt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Konstrukt
CPAN shell
perl -MCPAN -e shell install Konstrukt
For more information on module installation, please visit the detailed CPAN module installation guide.