
Sleep::Handler - ModPerl handler for Sleep.

I added this code in a Apache2 vhost file, for a example project that I created with Sleep, called QA.
<Perl>
use QA::Handler;
$QA::Global::object = QA::Handler->new();
</Perl>
<Location />
SetHandler perl-script
PerlResponseHandler $QA::Global::object->handler
</Location>
The QA::Handler file looks like this:
package QA::Handler;
use strict;
use warnings;
use QA::DB;
require Sleep::Handler;
our @ISA = qw/Sleep::Handler/;
my $db = QA::DB->Connect('QA');
my $routes = Sleep::Routes->new([
{
route => qr{/question(?:/(\d+))?$},
class => 'QA::Question'
},
{
route => qr{/question/(\d+)/comments$},
class => 'QA::Comment'
},
]);
sub new {
return __PACKAGE__->BUILD($db, $routes);
}
sub handler : method {
my $self = shift;
return $self->SUPER::handler(@_);
}
The module QA::DB is a subclass of DBIx::DWIW.

The Apache2 mod_perl handler for Sleep applications.

Creates a Sleep::Handler object. Expects two arguments: $db and routes.

Handles a HTTP request.

If you find a bug, please let the author know.

Copyright (c) 2008 Peter Stuifzand. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Peter Stuifzand <peter@stuifzand.eu>