NAME

Konstrukt::Request - Class for everything related to the page request

SYNOPSIS

#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();

DESCRIPTION

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.

METHODS

new

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'
	}
);

uri

Returns the current URI. If the URI parameter is defined, the current URI will be overwritten.

Parameters:

  • $uri - Optional: When defined, this URI will replace the current URI

method

Returns the current method. If the method parameter is defined, the current method will be overwritten.

Parameters:

  • $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.

Parameters:

  • $field - The header field

  • $value - Optional: When defined, this value will replace the current value for the specified header field

headers

Returns a hash reference containing all set header fields and the appropriate values.

AUTHOR

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.

SEE ALSO

Konstrukt::Response, Konstrukt::Handler