[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] CGI Printing Mystery



I am baffled by this cgi problem and hope someone can suggest what's going
wrong. The short version is that some stuff that I am doing for a client
needs to be cloaked so that instead of just using an html link to open a
file directly, the link runs a Perl script that completes the path to the
desired file and opens it for display in the user's browser. I am working in
MacPerl (NetPresenz) with the intention that the script will ultimately run
on Solaris (Netscape), but have not even gotten the thing to run correctly
on a Mac so far.

If a link is set up in a page displayed in the browser as
"http://207.69.245.70/cgi-bin/SBL/load4.acgi?book=job.html," the acgi opens
okay and if I just use the lines that are commented out below, everything is
fine. However, if I try to use the "while" structure to actually print the
file as intended, nothing happens until the browser times out and says the
document contained no data. The acgi applet never quits and has to be forced
down. Naturally, if I just use the Run command in MacPerl and provide the
name/value pair in offline mode, it works perfectly. So what's the deal?
Thanks.

#!/usr/local/bin/perl
use CGI;
my($cgi) = new CGI;
$dir_path="Poindexter:www.sbl-site.org:home:sbl-home:EPubs:c:";
$index_file=$dir_path.($cgi->param ('book'));

open(FILE,"$index_file") or die $!;

print $cgi->header();
#Ñ--these work----
#print "<HTML>";
#printf ("%s<P>", $cgi->param ('book'));
#print "$index_file<P>";
#print "file's open<P>";

#Ñ--this is broken----
while (<FILE>)
{
print;
}

close(FILE);
#Ñ--these work----
#print "file's CLOSED";
#print "</HTML>";

Richard Gordon
Gordon Consulting & Design
Voice: 770-565-8267  Fax: 770-971-6887



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch