summaryrefslogtreecommitdiff
path: root/lib/presque.pm
blob: 5d168d6030a16ef2d5662cfc097d7427b1135c93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package presque;

use Moose;
our $VERSION = '0.01';
extends 'Tatsumaki::Application';

use AnyEvent::Redis;

use presque::RestQueueHandler;
use presque::JobQueueHandler;
use presque::IndexHandler;

has config => (
    is => 'rw', isa => 'HashRef', lazy => 1, default => sub {}
);

has redis => (
    is => 'rw',
    isa => 'Object',
    lazy => 1,
    default => sub {
        my $self = shift;
        my $r = AnyEvent::Redis->new();
        $r;
    }
);

sub app {
    my ( $class, %args ) = @_;
    my $self = $class->new(
        [
            '/q/(.*)' => 'presque::RestQueueHandler',
            '/j/(.*)' => 'presque::JobQueueHandler',
            '/'   => 'presque::IndexHandler',
        ]
    );
    $self->config( delete $args{config} );
    $self;
}

1;
__END__

=head1 NAME

presque -

=head1 SYNOPSIS

  use presque;

=head1 DESCRIPTION

presque is

=head1 AUTHOR

franck cuny E<lt>franck@lumberjaph.netE<gt>

=head1 SEE ALSO

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut