#!/usr/bin/perl
use strict;

#print CGI header
print "Content-type: text/html\n\n";

#defs
#path to sql query
my $sql_file='/tmp/temp.sql';
#path to realy application
my $relay='./relay.pl';

#write query to temp file
open(FH, '>', "$sql_file");
print FH <<DONE;
<select db='prod'>
		*
	from
		OBJECT_ASSEMBLY
	where
		object_id='30216632016283' or
		object_id='30210440384626' or
		object_id='30200020006146'
</select>
DONE
close(FH);

#execute query
open(FH, "perl $relay $sql_file |");
my @results=<FH>;
close(FH);

#Display results in html
print "<html>";
print "<head><title>Example</title></head>";
print "<h2>Example</h2><hr>";
print "<body bgcolor=lightyellow>";
foreach(@results){
        print "<pre>$_</pre>";
}
print "</body>";
print "</html>";