PageRenderTime 303ms CodeModel.GetById 181ms app.highlight 5ms RepoModel.GetById 116ms app.codeStats 0ms

/lib/Teto.pm

http://github.com/motemen/Teto
Perl | 73 lines | 49 code | 24 blank | 0 comment | 1 complexity | ee4341a6519ad25741788bd5de2d3586 MD5 | raw file
 1package Teto;
 2use strict;
 3use warnings;
 4
 5our $VERSION = '0.31';
 6
 7sub context {
 8    our $Context ||= Teto::Context->new;
 9}
10
11sub reload {
12    require Module::Reload;
13    Module::Reload->check;
14}
15
16package Teto::Context;
17use Mouse;
18use Coro;
19
20has playlists => (
21    is  => 'rw',
22    isa => 'HashRef[Teto::Playlist]',
23    default => sub {
24        require Teto::Playlist;
25        return  Teto::Playlist->all;
26    },
27);
28
29with 'Teto::Role::Log';
30
31sub _build_buffer {
32    my $self = shift;
33    require Teto::Buffer;
34    return Teto::Buffer->new;
35}
36
37__PACKAGE__->meta->make_immutable;
38
39package Teto;
40
41for my $method (Teto::Context->meta->get_attribute_list) {
42    no strict 'refs';
43    *$method = sub { shift->context->$method };
44}
45
461;
47
48__END__
49
50=head1 NAME
51
52Teto - nicovideo audio streaming server
53
54=head1 SYNOPSIS
55
56  ./teto [playlist_url]
57
58=head1 DESCRIPTION
59
60Teto is a nicovideo audio streaming server.
61
62=head1 AUTHOR
63
64motemen E<lt>motemen@gmail.comE<gt>
65
66=head1 SEE ALSO
67
68=head1 LICENSE
69
70This library is free software; you can redistribute it and/or modify
71it under the same terms as Perl itself.
72
73=cut