Solved

PERL on NT - ReadParse

Posted on 1998-10-28
17
280 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
  • 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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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 …
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

770 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