Link to home
Start Free TrialLog in
Avatar of ficken
ficken

asked on

Perl CGI form won't run

I have a perl script that I am trying to execute with a web form on our CERN server, running on a sunsparc station. We have other CGI scripts running, and this specific script originally came from another organization where it still runs fine. When I try to execute the script from the command line it works fine, however, if I try to submit the form via the web, I get "Document Contains no Data" and nothing happens. Judging from the fact that the script runs fine at its original source, I doubt it is a Perl problem, but more likely a file permission or directory problem. The script and all related files are set to be executable and writable by root and my group, so I do not think the problem is there. I have attached a copy of the script below.

#!/opt/gnu/bin/perl
require "cgi-lib.pl";
&ReadParse              #Read in Variables from Forms

@TIME = split(  "\0", $in{'time'} );                  #These
@TAXA = split(  "\0", $in{'taxa'} );                  #Are
@GEOGRAPHY = split(  "\0", $in{'geography'} );            #Arrays

#Now let's count This Submission

open(COUNTER, "+< /home/WWW/ical/collections/counter.submit");
flock (COUNTER, 2);
$COUNT= <COUNTER>;      #Read the Current Value
$COUNT++;               #Increment Count
seek(COUNTER, 0 , 0);   #Rewind the file
print COUNTER $COUNT;   #Write the Incremented COUNT to file
flock (COUNTER, 8);
close COUNTER;

#Now let's Notify People That Someone Has Made An Addition

open (MAIL, "| /usr/lib/sendmail -oi -t" );
print MAIL <<NOTIFY;
To: ficken\@mobot.org
From:ICALposting\n

      This is a message from ICAL-Botany.
        $in{'name'} has made ICAL Submission #$COUNT for an $in{'type'} collection.
      You can view detailed information on the new collection at:
      http://www.mobot.org/ical/collections/$in{'title'}$in{'type'}$COUNT.html

      This collection covers:
      Time Periods: @TIME
      Taxa: @TAXA
      Geography: @GEOGRAPHY

      Hope you find it interesting!
NOTIFY
close MAIL;

#Let's Put some of this data in a file

open (DATAFILE, ">> /home/WWW/ical/collections/$in{'title'}$in{'type'}$COUNT.html");
flock (DATAFILE, 2);
print DATAFILE <<LIST_TOP;
      <html>
      <head><title>ICAL Submission #$COUNT, $in{'title'}</title></head>
      <body text=#12123F link=#cc6633 vlink=#12123F
            background="http://www.ucmp.berkeley.edu/ICAL/orphback2.gif">
      <h2>Submission #$COUNT, $in{'title'}, is for an $in{'type'} collection and
            comes from $in{'name'}</h2>
      <hr size=3 width=70%>
      <center><font size="+2"><b>Contact Information:</b></font>
      <hr size=3 width=94%>
      <table width=60% border=0>
      <tr><td valign=top align=right>Name:</td>
      <td valign=top><b>$in{'name'}</b></td></tr>
      <tr><td valign=top align=right>Institution:</td>
      <td valign=top><b>$in{'institution'}</b></td></tr>
      <tr><td nowrap valign=top align=right>Postal Address:</td>
      <td valign=top><b>$in{'address'}</b></td></tr>
      <tr><td nowrap valign=top align=right>Phone Number:</td>
      <td valign=top><b>$in{'phone'}</b></td></tr>
      <tr><td nowrap valign=top align=right>Facsimile Number:</td>
      <td valign=top><b>$in{'fax'}</b></td></tr>
      <tr><td nowrap valign=top align=right>Email Address:</td>
      <td valign=top><b><a href=mailto:$in{'email'}>$in{'email'}</a></b></td></tr>
      </table>
      <br>
      <hr size=3 width=70%>
      <table width=94% border=3>
      <tr colspan=3><font size="+2"><b>General Collection
              Attributes:</b></font></tr>
      <tr><td align=center><b>Geologic Age:</b></td>
      <td align=center><b>Taxonomic Coverage:</b></td>
      <td align=center><b>Geographic Range:</b></td></tr>
LIST_TOP

print DATAFILE "<tr><td valign=top>";
foreach $TIME (@TIME) { print DATAFILE "<li>$TIME \n"; }
print DATAFILE "</td>";

print DATAFILE "<td valign=top>";
foreach $TAXA (@TAXA) { print DATAFILE "<li>$TAXA \n"; }
print DATAFILE "</td>";

print DATAFILE "<td valign=top>";
foreach $GEOGRAPHY (@GEOGRAPHY) { print DATAFILE "<li>$GEOGRAPHY \n"; }
print DATAFILE "</td></tr>";

print DATAFILE <<LIST_BOTTOM;
       </table><P>
        <hr width=70% size=3>
        <font size="+2"><B>Specific Collection Attributes</b></font>
        <hr width=94% size=3>
        <table width=94% border=0>

        <tr><td align=right valign=top><b>Collector(s):</b></td>
        <td>$in{'collector'}</td></tr>

        <tr><td align=right valign=top><b>Date(s) Collected:</b></td>
        <td>$in{'date'}</td></tr>

        <tr><td nowrap align=right valign=top><b>Samples in Collection:</b></td>
        <td>$in{'samples'}</td></tr>

        <tr><td nowrap align=right valign=top><b>Volume of Collection:</b></td>
        <td>$in{'volume'}</td></tr>

        <tr><td nowrap align=right valign=top><b>Curatorial Status:</b></td>
        <td>$in{'curatorial'}</td></tr>

        <tr><td nowrap align=right valign=top><b>Geologic Formations:</b></td>
        <td>$in{'geolspecific'}</td></tr>

        <tr><td align=right valign=top><b>Specific Taxa:</b><br></td>
        <td>$in{'taxaspecific'}</td></tr>

        <tr><td nowrap align=right valign=top><b>Specific Localities:</b></td>
        <td>$in{'geogspecific'}</td></tr>

        <tr><td align=right valign=top><b>Other Notes:</b></td>
        <td>$in{'notes'}</td></tr>

        </table>
        </center><P>

      <hr width=70% size=3>
      <center><a href="http://www.ucmp.berkeley.edu/ICAL/"><== Orphan Home</a></center><br>

        <A HREF=http://www.ucmp.berkeley.edu/ICAL/auICAL.html>
        <IMG align=right SRC=http://www.ucmp.berkeley.edu/images/authors.gif
        WIDTH=68 HEIGHT=21></A>
        <A HREF=http://www.ucmp.berkeley.edu/copyright.html>
        <IMG align=right SRC=http://www.ucmp.berkeley.edu/images/copyright.gif
        WIDTH=21 HEIGHT=21></A>
        </body></html>
LIST_BOTTOM
flock (DATAFILE, 8);
close DATAFILE;

#Okay, now let's print out a nice web page for the person who
#just sent in some information on an available list



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

print <<TOP;
<html>
<head>
<title>Thank You for submitting $in{'title'} to ICAL</title></head>
<body text=#12123F link=#cc6633 vlink=#12123F
        background="http://www.ucmp.berkeley.edu/ICAL/orphback2.gif">
<center>
<font size="+2"><b>Thank You for Making Submission
      Number $COUNT, $in{'title'}, an $in{'type'} collection
      to<br>ICAL -- Paleontology</b></font>

<hr size=3 width=70%>
<font size="+2"><b>Your Contact Information:</b></font>
<hr size=3 width=94%>

<table width=60% border=0>

<tr><td valign=top align=right>Name:</td>
<td valign=top><b>$in{'name'}</b></td></tr>

<tr><td valign=top align=right>Institution:</td>
<td valign=top><b>$in{'institution'}</b></td></tr>

<tr><td nowrap valign=top align=right>Postal Address:</td>
<td valign=top><b>$in{'address'}</b></td></tr>

<tr><td nowrap valign=top align=right>Phone Number:</td>
<td valign=top><b>$in{'phone'}</b></td></tr>

<tr><td nowrap valign=top align=right>Facsimile Number:</td>
<td valign=top><b>$in{'fax'}</b></td></tr>

<tr><td nowrap valign=top align=right>Email Address:</td>
<td valign=top><b>$in{'email'}</b></td></tr>

</table>
<br>
<hr size=3 width=70%>

<table width=94% border=3>
<tr colspan=3><font size="+2"><b>General Collection
      Attributes:</b></font></tr>
<tr><td align=center><b>Geologic Age:</b></td>
<td align=center><b>Taxonomic Coverage:</b></td>
<td align=center><b>Geographic Range:</b></td></tr>

TOP

print "<tr><td valign=top>";
foreach $TIME (@TIME) { print "<li>$TIME \n"; }
print "</td>";

print "<td valign=top>";
foreach $TAXA (@TAXA) { print "<li>$TAXA \n"; }
print "</td>";

print "<td valign=top>";
foreach $GEOGRAPHY (@GEOGRAPHY) { print "<li>$GEOGRAPHY \n"; }
print "</td></tr>";

print <<FOOTER;

</table><P>
<hr width=70% size=3>
<font size="+2"><B>Specific Collection Attributes</b></font>
<hr width=94% size=3>
<table width=94% border=0>

<tr><td align=right valign=top><b>Collector(s):</b></td>
<td>$in{'collector'}</td></tr>

<tr><td align=right valign=top><b>Date(s) Collected:</b></td>
<td>$in{'date'}</td></tr>

<tr><td align=right valign=top><b>Samples in Collection:</b></td>
<td>$in{'samples'}</td></tr>

<tr><td align=right valign=top><b>Volume of Collection:</b></td>
<td>$in{'volume'}</td></tr>
 
<tr><td align=right valign=top><b>Curatorial Status:</b></td>
<td>$in{'curatorial'}</td></tr>
 
<tr><td align=right valign=top><b>Geologic Formations:</b></td>
<td>$in{'geolspecific'}</td></tr>

<tr><td align=right valign=top><b>Specific Taxa:</b><br></td>
<td>$in{'taxaspecific'}</td></tr>

<tr><td align=right valign=top><b>Specific Localities:</b></td>
<td>$in{'geogspecific'}</td></tr>

<tr><td align=right valign=top><b>Other Notes:</b></td>
<td>$in{'notes'}</td></tr>

</table>
</center><P>

<hr width=70% size=5>
<center><a href="http://www.ucmp.berkeley.edu/ICAL/"><== Orphan Home</a></center><br>

<A HREF=http://www.ucmp.berkeley.edu/ICAL/auICAL.html>
<IMG align=right SRC=http://www.ucmp.berkeley.edu/images/authors.gif  
WIDTH=68 HEIGHT=21></A>
<A HREF=http://www.ucmp.berkeley.edu/copyright.html>
<IMG align=right SRC=http://www.ucmp.berkeley.edu/images/copyright.gif  
WIDTH=21 HEIGHT=21></A>
</body></html>
FOOTER

exit;
Avatar of ficken
ficken

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of Kallisti
Kallisti

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial