#!/usr/bin/env perl

=pod

=head1 NAME

wrt-fcgi - Sample FastCGI wrapper script for WRT.pm

=head1 DESCRIPTION

Pulls in WRT.pm and CGI::Fast, runs a configuration file, and loops over
FastCGI queries, passing their parameters to WRT::display().

=cut

use strict;
use warnings;
no  warnings 'uninitialized';

use CGI::Fast;
use WRT;

my $w = WRT::new_from_file('wrt.json');

# use Data::Dumper;

# Handle input from FastCGI:
while (my $query = CGI::Fast->new) {
  my @params = $query->multi_param('keywords');
  print "Content-Type: text/html\n\n"; 
  print $w->display(@params);
}

exit;
