Solved

Perl CGI form won't run

Posted on 1997-03-31
2
335 Views
Last Modified: 2013-12-25
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;
0
Comment
Question by:ficken
2 Comments
 

Author Comment

by:ficken
ID: 1827858
Edited text of question
0
 
LVL 1

Accepted Solution

by:
Kallisti earned 200 total points
ID: 1827859
I _VERY_ much suspect it is simply that your
require line is failing.  This can happen as
the directory the cgi scripts are run in by
the server are rarely the directory they
actually are in.

Try putting it in a few places?  Usually the
document root.

If this does not work, please post any relevant
lines from your error log if they exist?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now