AnyEvent-DAAP-Server
view release on metacpan or search on metacpan
- inc
- t
- xt
requires:
Any::Moose: 0
AnyEvent: 0
AnyEvent::Handle: 0
AnyEvent::Socket: 0
File::Basename: 0
File::Find::Rule: 0
HTTP::Request: 0
HTTP::Response: 0
MP3::Info: 0
Net::DAAP::DMAP: 0
Net::Rendezvous::Publish: 0
Router::Simple: 0
URI: 0
URI::QueryParam: 0
resources:
license: http://dev.perl.org/licenses/
repository: git://github.com/motemen/AnyEvent-DAAP-Server.git
Makefile.PL view on Meta::CPAN
name 'AnyEvent-DAAP-Server';
all_from 'lib/AnyEvent/DAAP/Server.pm';
requires 'Any::Moose';
requires 'AnyEvent';
requires 'AnyEvent::Socket';
requires 'AnyEvent::Handle';
requires 'Net::Rendezvous::Publish';
requires 'Net::DAAP::DMAP';
requires 'Router::Simple';
requires 'HTTP::Request';
requires 'HTTP::Response';
requires 'URI';
requires 'URI::QueryParam';
requires 'MP3::Info';
requires 'File::Basename';
requires 'File::Find::Rule';
tests 't/*.t';
author_tests 'xt';
package AnyEvent::DAAP::Server;
use Any::Moose;
use AnyEvent::DAAP::Server::Connection;
use AnyEvent::Socket;
use AnyEvent::Handle;
use Net::Rendezvous::Publish;
use Net::DAAP::DMAP qw(dmap_pack);
use HTTP::Request;
use Router::Simple;
use URI::QueryParam;
our $VERSION = '0.01';
has name => (
is => 'rw',
isa => 'Str',
default => sub { ref $_[0] },
);
$self->publish;
tcp_server undef, $self->port, sub {
my ($fh, $host, $port) = @_;
my $connection = AnyEvent::DAAP::Server::Connection->new(server => $self, fh => $fh);
$connection->handle->on_read(sub {
my ($handle) = @_;
$handle->push_read(
regex => qr<\r\n\r\n>, sub {
my ($handle, $data) = @_;
my $request = HTTP::Request->parse($data);
my $path = $request->uri->path;
my $p = $self->router->match($path) || {};
my $method = $p->{method} || $path;
$method =~ s<[/-]><_>g;
$self->$method($connection, $request, $p);
}
);
});
push @{ $self->connections }, $connection;
};
lib/AnyEvent/DAAP/Server.pm view on Meta::CPAN
package AnyEvent::DAAP::Server;
use Any::Moose;
use AnyEvent::DAAP::Server::Connection;
use AnyEvent::Socket;
use AnyEvent::Handle;
use Net::Rendezvous::Publish;
use Net::DAAP::DMAP qw(dmap_pack);
use HTTP::Request;
use Router::Simple;
use URI::QueryParam;
our $VERSION = '0.01';
has name => (
is => 'rw',
isa => 'Str',
default => sub { ref $_[0] },
);
lib/AnyEvent/DAAP/Server.pm view on Meta::CPAN
$self->publish;
tcp_server undef, $self->port, sub {
my ($fh, $host, $port) = @_;
my $connection = AnyEvent::DAAP::Server::Connection->new(server => $self, fh => $fh);
$connection->handle->on_read(sub {
my ($handle) = @_;
$handle->push_read(
regex => qr<\r\n\r\n>, sub {
my ($handle, $data) = @_;
my $request = HTTP::Request->parse($data);
my $path = $request->uri->path;
my $p = $self->router->match($path) || {};
my $method = $p->{method} || $path;
$method =~ s<[/-]><_>g;
$self->$method($connection, $request, $p);
}
);
});
push @{ $self->connections }, $connection;
};
( run in 0.883 second using v1.01-cache-2.11-cpan-de7293f3b23 )