PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Teto/Tatsumaki/Application.pm

http://github.com/motemen/Teto
Perl | 28 lines | 25 code | 3 blank | 0 comment | 1 complexity | cde93b10257fee61f835429eaf7ae624 MD5 | raw file
 1package Teto::Tatsumaki::Application;
 2use strict;
 3use warnings;
 4use parent 'Tatsumaki::Application';
 5use Teto::Tatsumaki::Handler::Index;
 6use Teto::Tatsumaki::Handler::Stream;
 7use Teto::Tatsumaki::Handler::Debug;
 8use Teto::Tatsumaki::Handler::API;
 9use Path::Class;
10use File::ShareDir qw(dist_dir);
11use FindBin;
12
13my $root = eval { dist_dir('Teto') } || dir($FindBin::Bin)->subdir('root').q();
14
15sub new {
16    my $class = shift;
17    my $self = $class->SUPER::new([
18        '/'          => 'Teto::Tatsumaki::Handler::Index',
19        '/stream'    => 'Teto::Tatsumaki::Handler::Stream',
20        '/debug'     => 'Teto::Tatsumaki::Handler::Debug',
21        '/api/(\w+)' => 'Teto::Tatsumaki::Handler::API',
22    ]);
23    $self->template_path($root);
24    $self->static_path  ($root);
25    return $self;
26}
27
281;