App-CPANIDX
view release on metacpan or search on metacpan
bin/cpanidx-fcgi view on Meta::CPAN
die "No 'dsn' was specified in the config file '$config', aborting\n" unless $dsn;
my $dbh = DBI->connect($dsn,$user,$pass) or die $DBI::errstr, "\n";
my $socket = FCGI::OpenSocket( $port, 5 );
my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR,
\%ENV, $socket );
FCGI: while( $request->Accept() >= 0 ) {
my $path = $ENV{'REQUEST_URI'};
my ($root,$enc,$type,$search) = grep { $_ } split m#/#, $path;
$search = '0' if $type =~ /^next/ and !$search;
my @results = _search_db( $type, $search );
#$enc = 'yaml' unless $enc and $enc =~ /^(yaml|json|xml|html)$/i;
$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 "Content-type: $ctype\r\n\r\n";
print $string;
}
( run in 0.678 second using v1.01-cache-2.11-cpan-63c85eba8c4 )