Solved

Perl CGI form won't run

Posted on 1997-03-31
2
338 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ready Made PHP Scripts 5 69
Batch File to find and replace a string 15 111
Need help editing script 3 72
exchange ,script 10 41
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

786 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