LJ Archive
#!/usr/bin/perl -w
use strict vars;
use diagnostics;
use CGI;
use Mysql;
use Text::Template;

# Create an instance of CGI
my $query = new CGI;

# Send an appropriate HTTP header
print $query->header("text/html");

# Get the filename from the query string
my $filename = $query->param("keywords");

# Log an error if the file doesn't exist
&log_and_die(
"Could not find the file \"$filename\"!")
 unless (-s $filename);

# Create an instance of Text::Template
my $template = new Text::Template("type" =>
 "FILE", "source" => $filename);

# Evaluate the Perl inside the template, and send
# the results to the user's browser
$VARS::query = $query;
print $template->fill_in('package' => VARS);
exit;
LJ Archive