Solved

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

Posted on 2001-08-21
5
159 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

791 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