Sleep::Handler - ModPerl handler for Sleep.


Sleep documentation  | view source Contained in the Sleep distribution.

Index


NAME

Top

Sleep::Handler - ModPerl handler for Sleep.

SYNOPSYS

Top

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.

DESCRIPTION

Top

The Apache2 mod_perl handler for Sleep applications.

CLASS METHODS

Top

BUILD($db, $routes)

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

METHODS

Top

handler

Handles a HTTP request.

BUGS

Top

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

COPYRIGHT

Top

AUTHOR

Top

Peter Stuifzand <peter@stuifzand.eu>


Sleep documentation  | view source Contained in the Sleep distribution.