Solved

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

Posted on 2001-08-21
5
161 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
[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
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

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…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

752 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