[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Perl CGI form won't run

Posted on 1997-03-31
2
Medium Priority
?
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

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

Accepted Solution

by:
Kallisti earned 600 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
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…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

656 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