=head1 NAME Apache::SWIT - mod_perl based application server with integrated testing. =head1 SYNOPSIS 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'; } =head1 DISCLAIMER This is pre-alpha quality software. Please use it on your own risk. =head1 DESCRIPTION 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. =head1 METHODS =cut use strict; use warnings FATAL => 'all'; package Apache::SWIT; use Carp; use Data::Dumper; use File::Slurp; our $VERSION = 0.54; sub swit_startup {} =head2 $class->swit_send_http_header($r, $ct) Sends HTTP default headers: session cookie and content type. C<$r> is apache request and C<$ct> is optional content type (defaults to C. =cut sub swit_send_http_header { my ($class, $r, $ct) = @_; $r->pnotes('SWITSession')->end; $r->pnotes('SWITSession', undef); $r->content_type($ct || "text/html; charset=utf-8"); } =head2 $class->swit_die($msg, $r, @data_to_dump) Dies with first line of C<$msg> using Carp::croak and dumps request C<$r> and C<@data_to_dump> with Data::Dumper into /tmp/swit_