/lib/Teto.pm

http://github.com/motemen/Teto · Perl · 73 lines · 49 code · 24 blank · 0 comment · 1 complexity · ee4341a6519ad25741788bd5de2d3586 MD5 · raw file

  1. package Teto;
  2. use strict;
  3. use warnings;
  4. our $VERSION = '0.31';
  5. sub context {
  6. our $Context ||= Teto::Context->new;
  7. }
  8. sub reload {
  9. require Module::Reload;
  10. Module::Reload->check;
  11. }
  12. package Teto::Context;
  13. use Mouse;
  14. use Coro;
  15. has playlists => (
  16. is => 'rw',
  17. isa => 'HashRef[Teto::Playlist]',
  18. default => sub {
  19. require Teto::Playlist;
  20. return Teto::Playlist->all;
  21. },
  22. );
  23. with 'Teto::Role::Log';
  24. sub _build_buffer {
  25. my $self = shift;
  26. require Teto::Buffer;
  27. return Teto::Buffer->new;
  28. }
  29. __PACKAGE__->meta->make_immutable;
  30. package Teto;
  31. for my $method (Teto::Context->meta->get_attribute_list) {
  32. no strict 'refs';
  33. *$method = sub { shift->context->$method };
  34. }
  35. 1;
  36. __END__
  37. =head1 NAME
  38. Teto - nicovideo audio streaming server
  39. =head1 SYNOPSIS
  40. ./teto [playlist_url]
  41. =head1 DESCRIPTION
  42. Teto is a nicovideo audio streaming server.
  43. =head1 AUTHOR
  44. motemen E<lt>motemen@gmail.comE<gt>
  45. =head1 SEE ALSO
  46. =head1 LICENSE
  47. This library is free software; you can redistribute it and/or modify
  48. it under the same terms as Perl itself.
  49. =cut