| Apache-SWIT documentation | view source | Contained in the Apache-SWIT distribution. |
Apache::SWIT - mod_perl based application server with integrated testing.
package MyHandler;
use base 'Apache::SWIT';
# overload render routine
sub swit_render {
my ($class, $r) = @_;
return ({ hello => 'world' }, 'my_template.tt');
# or return { hello => 'world' }; to rely on swit.yaml
# based generation
}
# overload update routine, usually result of POST
sub swit_update {
my ($class, $r) = @_;
# do some work ...
# and redirect to another page
return '/redirect/to/some/url';
}
This is pre-alpha quality software. Please use it on your own risk.
This module serves as yet another mod_perl based application server.
It tries to capture several often occuring paradigms in mod_perl development. It provides user with the tools to bootstrap a new project, write tests easily, etc.
Sends HTTP default headers: session cookie and content type. $r is apache
request and $ct is optional content type (defaults to
text/html; charset=utf-8.
Dies with first line of $msg using Carp::croak and dumps request $r and
@data_to_dump with Data::Dumper into /tmp/swit_<time>.err file.
Maximal size of POST request. Default is 1M. Overload it to return something else.
Entry point for an update handler. Calls $class->swit_update($apr) function with
Apache2::Request parameter. The result of swit_update henceforth is called
$to is passed down.
If $to is regular string then 302 status is produced with Location equal to
$to.
If $to is array reference and first item is a number then the status with
$to-[0]> is produced and $to->[1] is returned as response body. $to->[2]
may by used as content type.
I.e. [ 200, "Hello", "text/plain" ] will respond with 200 OK status and
Hello as a body with text/plain as content type.
The first item can also be INTERNAL magic string. In that case internal
redirect to the second array item is produced.
Of $to parameters only $to->[0] is mandatory.
Much needed documentation is non-existant at the moment.
Boris Sukholitko boriss@gmail.com
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
HTML::Tested
| Apache-SWIT documentation | view source | Contained in the Apache-SWIT distribution. |