Solved

PERL on NT - ReadParse

Posted on 1998-10-28
17
277 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
Comment Utility
Please help QUICK.
0
 

Author Comment

by:akeller
Comment Utility
Edited text of question
0
 

Author Comment

by:akeller
Comment Utility
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
 
LVL 84

Expert Comment

by:ozo
Comment Utility
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
Comment Utility
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
Comment Utility
Edited text of question
0
 

Author Comment

by:akeller
Comment Utility
Please assist as soon as possible!!! Thanks
0
 

Author Comment

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

Please help.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 84

Expert Comment

by:ozo
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Please lock this so I can grade you and give you your A++++
0
 

Author Comment

by:akeller
Comment Utility
Please lock so I can grade.  Thanks
0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
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
Comment Utility
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
Comment Utility
Please have alamo lock this question!
0
 
LVL 6

Accepted Solution

by:
alamo earned 20 total points
Comment Utility
Glad i could help, Anna!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now