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

NAME

Konstrukt::Response - Class for everything related to the generated response

SYNOPSIS

        #set/get status code
        $Konstrukt::Response->status('200');
        my $s = $Konstrukt::Request->status();

        #set/get header
        $Konstrukt::Response->header('Content-Type' => 'text/html');
        my $c = $Konstrukt::Response->header('Content-Type');
        
        #all heades as hash ref
        my $h = $Konstrukt::Response->headers();
        

DESCRIPTION

This object will provide access to some response-related information for the response, which is currently generated.

Usually you will only set data for the respons, but you may also read it.

To get the request data you should use Konstrukt::Request.

It's similar to HTTP::Response but without some methods, that are not needed here.

METHODS

new

Parameters:

To initialize the response object you can specify these optional keys:

        my $r = Konstrukt::Response->new(
                status  => '200',
                headers => {
                        'Content-Type' => 'text/html'
                }
        );

status

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

Parameters:

  • $status - Optional: When defined, this status code will replace the current status code

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::Request, Konstrukt::Handler