Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

PERL on NT - ReadParse

PLEASE HELP FAST!

The following PERL program is being ran from an HTML FORM with a POST method.  Instead of taking the input from the calling form it prompts me in a dos window for the name=value pairs in a dos window.  why?  Help Please. My PC dev env is PC NT and browser is netscape with basic html.

#! perl.exe
use CGI;
CGI::ReadParse(*input);
# saveFormData
my($dataFile) = "userlog.dat";
open(FILE, ">>$dataFile") or die("Unable to open output data file.");
print FILE ("$input{fullname}~");
print FILE ("$input{fullurl}~");
print FILE ("$input{comments}~");
print FILE ("\n");
close(FILE);
# Generate HTML to display Log file
print("Content-type: text/html\n\n");
print("<HTML>\n");
print("<HEAD><TITLE>Feedback</TITLE></HEAD><br>");
print("<H1>Got Data Below from form</H1>");
print("<HR>");
print("$input{fullname}<br>");
print("$input{fullurl}<br>");
print("$input{comments}<br>");
print("</BODY><br>");      
print("</HTML><br>");

0
akeller
Asked:
akeller
  • 12
  • 3
  • 2
1 Solution
 
akellerAuthor Commented:
Please help QUICK.
0
 
akellerAuthor Commented:
Edited text of question
0
 
akellerAuthor Commented:
Please help QUICKLY.  I needed this yesterday.  If this works out in a timely manner my employer may fund this effort for their perl developers.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ozoCommented:
It works for me
What do you get if you print $ENV{REQUEST_METHOD},  $ENV{CONTENT_TYPE} and $ENV{CONTENT_LENGTH}?
What happens if you call it with GET?
0
 
akellerAuthor Commented:
Here is the HTML:
<HTML>
<HEAD>
<TITLE>CERPs User Log File</TITLE>
</HEAD>
<BODY>
<FORM METHOD="post" ACTION="cerptest.pl">
Your Name:  <INPUT TYPE="text" NAME="fullname"><br>
Your URL:  <INPUT TYPE="text" NAME="fullurl"><br>
Your Comments: <TEXTAREA NAME="comments" ROWS=3 COLS=60></TEXTAREA><br>
<INPUT TYPE="submit" VALUE="Add To Log">
</FORM>
</BODY>
</BODY>
</HTML>

Here is the PL program with the print of the ENV Varialbes:
#! perl.exe
use CGI;
CGI::ReadParse(*input);
print("$ENV{REQUEST_METHOD},$ENV{CONTENT_TYPE},$ENV{CONTENT_LENGTH}\n");
# saveFormData
my($dataFile) = "userlog.dat";
open(FILE, ">>$dataFile") or die("Unable to open output data file.");
print FILE ("$input{fullname}~");
print FILE ("$input{fullurl}~");
print FILE ("$input{comments}~");
print FILE ("\n");
close(FILE);
# Generate HTML to display Log file
print("Content-type: text/html\n\n");
print("<HTML>\n");
print("<HEAD><TITLE>Feedback</TITLE></HEAD><br>");
print("<H1>Got Data Below from form</H1>");
print("<HR>");
print("$input{fullname}<br>");
print("$input{fullurl}<br>");
print("$input{comments}<br>");
print("</BODY><br>");      
print("</HTML><br>");

Result:
I had to run the perl program at a dos prompt to see the prints and the env variables were empty.  When I run the html the submit button seems to do nothing.  Why?

POST Changed to GET:
When I do this and runt he form I get the following message window:
Opening:
cerptest.pl using Perl.exe
When you download a file from the network, you should be
aware of security considerations .....
Then I have options to openit or save it to disk.
Here is the changed html (WITH GET and not POST).

<HTML>
<HEAD>
<TITLE>CERPs User Log File</TITLE>
</HEAD>
<BODY>
<FORM METHOD="get" ACTION="cerptest.pl">
Your Name:  <INPUT TYPE="text" NAME="fullname"><br>
Your URL:  <INPUT TYPE="text" NAME="fullurl"><br>
Your Comments: <TEXTAREA NAME="comments" ROWS=3 COLS=60></TEXTAREA><br>
<INPUT TYPE="submit" VALUE="Add To Log">
</FORM>
</BODY>
</BODY>
</HTML>

Please Help : (
0
 
akellerAuthor Commented:
Edited text of question
0
 
akellerAuthor Commented:
Please assist as soon as possible!!! Thanks
0
 
akellerAuthor Commented:
My home e-mail is cleintserver@compuserve.com and my work email is akeller@cleveland.dfas.mil

Please help.
0
 
ozoCommented:
Are you seeing those prompts on the server or the client?
It sounds like your http server is not running your program as a CGI but is instead downloading it as a file.
You may want to check your server documentation to see how to configure it to run CGI programs.
0
 
alamoCommented:
As ozo said, you need a web server to run perl programs. Do you have one?

It looks like you aren't using a web server at all, at least to load the original HTML page. It could be that simple though - because you have a relative URL  for ACTION - ACTION="cerptest.pl" - then when you load the HTML as a file:// then it tries to load the script as a file, and you get the results you see. The first thing to do is to change the ACTION to a full URL, an example being ACTION="http://localhost/scripts/cerptest.pl". Then even if you load the HTML page as a file you'll call the script properly.
0
 
akellerAuthor Commented:
You got me.  I knew I could do my HTML and JAVAScript without a server, so I thought that perl was the same.  Thank You. Good Work
0
 
akellerAuthor Commented:
Please lock this so I can grade you and give you your A++++
0
 
akellerAuthor Commented:
Please lock so I can grade.  Thanks
0
 
alamoCommented:
akeller, the delay is because you didn't say who you want to grade, who do you want to lock the question?
0
 
akellerAuthor Commented:
Please have alamo lock the question.  I have 2 more questions out there I would like ozo to try to answer.  My boss is also willing to pay for more points (so I can offer more) but my boss isa federal government agency which needs information before they invest - allocate funds.  My fax is 1.216.522.5608.  Please send what you can related to the program/support/costs/special-government-rates/packages and have alamo lock this question for grading and try to answer my other questions.

Thanks
Anna
0
 
akellerAuthor Commented:
Please have alamo lock this question!
0
 
alamoCommented:
Glad i could help, Anna!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 12
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now