[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Way OT] perl, CGI, and sendmail



On Sun, Apr 10, 2005 at 11:25:48PM +0200, Almut Behrens wrote:
> On Sun, Apr 10, 2005 at 03:39:08PM -0500, David wrote:
> > I know this ain't Debian but I've racked my brain on this.
> > 
> > Been experimenting with CGI, using perl.  I have a form that generates
> > the needed variables, etc.
> > 
> > I have it to where when I submit the data, the mail is sent and I
> > receive it (FWIW, using exim4), Exim doesn't report any errors, but I
> > get a 500 error (Internal Server Error) from apache (1.3.33-4).
> 
> You're not generating any output to return to the browser (you know,
> that typical pretty useless page "Your mail has been sent. Thank you
> for ..." ;)

No, that file I attached was the entire thing - it's just a learning
project.

> When a CGI script doesn't produce any output, it's
> considered an "internal error" by the server.

But I was getting output.  In the sendmail example I included, I
received a perfect mail.  As I said in the OP, no errors showed up in
the exim logs, but I'd get an "Internal Error" report in the web browser
and the apache logs reported a 500 error.  IOW, it appears that perl
processed the script all the way but was returning an error to apache
for some reason.

If I edited the cgi.pl file by commentint out the sendmail stuff and
added some html tags and sending to stdout (in the pl), I got the
correct message in the browser and a 200 status in the logs.

> If you really do not
> want to send anything back, you could make use of the HTTP status code
> 204 (No Content).  In this case, both the server and the browser will
> be happy about not having anything to exchange...
> If you want to try the latter, but can't figure out how to return 204
> instead of the normal 200, just report back (maybe off-list, as this
> really isn't debian any longer :)

It certainly isn't..  I was just hoping for a quick answer as to what's
wrong with the script - I'm sure that it's something in the script.

> BTW, it suffices to simply 'use CGI qw(...);' -- no need for an extra
> 'require "CGI.pm":'

I'm rather new to perl and that part was taking an example from a tutorial.

Actually, I used that tutorial as a pattern to go by.



Reply to: