Solved

New to CGI/Perl, so this is easy (I guess)..

Posted on 2001-08-21
5
158 Views
Last Modified: 2013-12-25
I made the following script:
-----------------------------
#!/bin/perl
my $in;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{     $in=$ENV{'QUERY_STRING'};}
else {      $in=<STDIN>; }

print "TEST";
------------------------------

If I am not too wrong, this should just print "TEST" on any website.

The HTML form looks like this:
------------------------------
<form name="form1" method="post" action="/cgi/test.pl">
  <input type="submit" name="Submit" value="Submit">
</form>
------------------------------

When I click on the button, I get an internal server error? Other cgi's (which my collegues built) works fine on the same server..same directories.

I changed the .pl file to be executable..but it still doesn't work. Please help =)
0
Comment
Question by:thomas77
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
bebonham earned 100 total points
ID: 6410653
it could be that you are not pointing to the right perl
make sure the path to perl is correct, usually
#!/usr/bin/perl

but I know you have to change this...

so try the below:

#!/bin/perl

print "Content-type: text/html\n\n";  ##tell the browser to expect html
my $in;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{     $in=$ENV{'QUERY_STRING'};}
else {      $in=<STDIN>; }

print "TEST";
0
 

Author Comment

by:thomas77
ID: 6410686
Great and quick answer!
Thanks mate =)

/Thomas
0
 

Author Comment

by:thomas77
ID: 6410687
It was the Print Content stuff..
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6410703
figured as much..

good luck, enjoy Perl!!

Thanks for the 'A' Grade
0
 

Author Comment

by:thomas77
ID: 6410711
It was the Print Content stuff..
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python multiple IF statements 4 75
Connect two temperature sensors DS18b20 to Particle Photon 2 62
Update a registry value to every user hive 15 72
Bulk Reorder File Names 4 56
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
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 look for a specific file type in a local or remote server directory using PHP.

910 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

20 Experts available now in Live!

Get 1:1 Help Now