App-CPANIDX-HTTP-Server
view release on metacpan or search on metacpan
lib/App/CPANIDX/HTTP/Server.pm view on Meta::CPAN
return $self->{_dsn};
}
sub handle_request {
my $self = shift;
my $cgi = shift;
my $path = $cgi->path_info();
$path =~ s!/+!/!g;
warn $path, "\n";
my ($root,$enc,$type,$search) = grep { $_ } split m#/#, $path;
if ( $root eq 'cpanidx' and $enc and $type ) {
$search = '0' if $type =~ /^next/ and !$search;
my @results = $self->_search_db( $type, $search );
$enc = 'yaml' unless $enc and grep { lc($enc) eq $_ } App::CPANIDX::Renderer->renderers();
my $ren = App::CPANIDX::Renderer->new( \@results, $enc );
my ($ctype, $string) = $ren->render( $type );
print "HTTP/1.0 200 OK\r\n";
print "Content-type: $ctype\r\n\r\n";
print $string;
( run in 1.071 second using v1.01-cache-2.11-cpan-7e98afdb40f )