NAME

MKDoc::Core::Response - MKDoc Response object.

SUMMARY

This object defines the response which is sent back to the client.

It is not mandatory to use it, but it is quite nice and convenient.

API

$class->instance();

Returns the MKDoc::Core::Response singleton - or creates it if necessary.

$class->new();

Instanciates an MKDoc::Core::Response object from either a $string as returned by $self->get(), or @args which is a hash.

    my $response = new MKDoc::Core::Response
        Status       => '200 OK',
        Set-Cookie   => 'EvilCookie',
        Content-Type => 'text/plain',
        BODY         => 'Hello, World!';

    my $clone = new MKDoc::Core::Response ($response->get());

$self->HEAD();

Returns the head of the HTTP query.

$self->GET();

Returns the head plus the body of the HTTP query.

$self->Status();

Setter / Getter for the response status code.

$self->Status ("404 Not Found");

$self->Body();

Setter / Getter for the message body.

$self->Xxx();

Setter / Getter for any other header.

Any other header can be set through the AUTOLOAD method. e.g.

    $self->X_Foo ("Bar");

Will automagically add the header:

    X-Foo: Bar

$self->out();

Outputs the response to STDOUT.

AUTHOR

Copyright 2003 - MKDoc Holdings Ltd.

Author: Jean-Michel Hiver

This module is free software and is distributed under the same license as Perl itself. Use it at your own risk.

SEE ALSO

  L<Petal> TAL for perl
  MKDoc: http://www.mkdoc.com/

Help us open-source MKDoc. Join the mkdoc-modules mailing list:

  mkdoc-modules@lists.webarch.co.uk