/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

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