Solved

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

Posted on 2001-08-21
5
157 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
Comment Utility
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
Comment Utility
Great and quick answer!
Thanks mate =)

/Thomas
0
 

Author Comment

by:thomas77
Comment Utility
It was the Print Content stuff..
0
 
LVL 8

Expert Comment

by:bebonham
Comment Utility
figured as much..

good luck, enjoy Perl!!

Thanks for the 'A' Grade
0
 

Author Comment

by:thomas77
Comment Utility
It was the Print Content stuff..
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

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 tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
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…

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