Solved

PERL on NT - ReadParse

Posted on 1998-10-28
17
283 Views
Last Modified: 2010-05-18
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
Comment
Question by:akeller
[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
  • 12
  • 3
  • 2
17 Comments
 

Author Comment

by:akeller
ID: 1205766
Please help QUICK.
0
 

Author Comment

by:akeller
ID: 1205767
Edited text of question
0
 

Author Comment

by:akeller
ID: 1205768
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
Industry Leaders: 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!

 
LVL 84

Expert Comment

by:ozo
ID: 1205769
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
 

Author Comment

by:akeller
ID: 1205770
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
 

Author Comment

by:akeller
ID: 1205771
Edited text of question
0
 

Author Comment

by:akeller
ID: 1205772
Please assist as soon as possible!!! Thanks
0
 

Author Comment

by:akeller
ID: 1205773
My home e-mail is cleintserver@compuserve.com and my work email is akeller@cleveland.dfas.mil

Please help.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1205774
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
 
LVL 6

Expert Comment

by:alamo
ID: 1205775
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
 

Author Comment

by:akeller
ID: 1205776
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
 

Author Comment

by:akeller
ID: 1205777
Please lock this so I can grade you and give you your A++++
0
 

Author Comment

by:akeller
ID: 1205778
Please lock so I can grade.  Thanks
0
 
LVL 6

Expert Comment

by:alamo
ID: 1205779
akeller, the delay is because you didn't say who you want to grade, who do you want to lock the question?
0
 

Author Comment

by:akeller
ID: 1205780
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
 

Author Comment

by:akeller
ID: 1205781
Please have alamo lock this question!
0
 
LVL 6

Accepted Solution

by:
alamo earned 20 total points
ID: 1205782
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!

Question has a verified solution.

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

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

739 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