Use CGI::CARP qw(fatalsToBrowser) not working

Use CGI::CARP qw(fatalsToBrowser) not working

am 03.12.2004 13:13:29 von Joe Blow

Hi all,
When I include this line in the script, the errors don't appear within
the browser window. I am still having to dig through the error_log to
find out what happened, or execute perl test.cgi from a terminal window.

The following is displayed in the browser if any error occurs within the
script:

SERVER ERROR
The server encountered an error ………….
Error message:
Premature end of script headers: test.cgi

OS: recently installed RH9 (SHRIKE)

Could this be an Apache httpd.conf setup error?

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 03.12.2004 14:05:19 von Gunnar Hjalmarsson

[ Subject: Use CGI::CARP qw(fatalsToBrowser) not working ]

Joe Blow wrote:
> When I include this line in the script, the errors don't appear within
> the browser window.

Perl is case sensitive.

use CGI::Carp qw(fatalsToBrowser);

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 04.12.2004 00:25:53 von Joe Blow

Hi again all,
I posted the question as: Use CGI::CARP qw(fatalsToBrowser) not working
When in fact the code I have within the script is:
use CGI::Carp qw(fatalsToBrowser)

This is not functioning correctly. The outputs don't go to the browser
window.

Anybody with any hints?

Joe

Thanks - Gunnar Hjalmarsson for pointing out the mistake in the subject
line

Joe Blow wrote:
>
> Hi all,
> When I include this line in the script, the errors don't appear within
> the browser window. I am still having to dig through the error_log to
> find out what happened, or execute perl test.cgi from a terminal window.
>
> The following is displayed in the browser if any error occurs within the
> script:
>
> SERVER ERROR
> The server encountered an error ………….
> Error message:
> Premature end of script headers: test.cgi
>
> OS: recently installed RH9 (SHRIKE)
>
> Could this be an Apache httpd.conf setup error?

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 04.12.2004 01:22:51 von Gunnar Hjalmarsson

[ Please do not top-post! ]

Joe Blow wrote:
>
> use CGI::Carp qw(fatalsToBrowser)
>
> This is not functioning correctly. The outputs don't go to the
> browser window.
>
> Anybody with any hints?

Is CGI::Carp correctly installed? Try this script:

#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
print "Content-type: text/plain\n\n";
print CGI::Carp->VERSION, "\n";

Are you running under mod_perl?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 04.12.2004 04:56:06 von Matt Garrish

"Joe Blow" wrote in message
news:41B0F551.1F3B9FE0@joe.com.ph...
>>
>> The following is displayed in the browser if any error occurs within the
>> script:
>>
>> SERVER ERROR
>> The server encountered an error .....
>> Error message:
>> Premature end of script headers: test.cgi
>>

Well, the obvious question is are you sending the correct headers? Sounds
like your script is executing fine, but your sending an improper header to
the browser, and malformed http headers are not going to be caught by the
perl interpreter.

Matt

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 04.12.2004 12:00:27 von Gunnar Hjalmarsson

Matt Garrish wrote:
> "Joe Blow" wrote in message
> news:41B0F551.1F3B9FE0@joe.com.ph...
>
>>>The following is displayed in the browser if any error occurs within the
>>>script:
>>>
>>>SERVER ERROR
>>>The server encountered an error .....
>>>Error message:
>>>Premature end of script headers: test.cgi
>
> Well, the obvious question is are you sending the correct headers?

Not that obvious, since CGI::Carp prints a content-type header. The OP
also gave the impression that the script normally runs without errors
("if any error occurs").

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 04.12.2004 18:12:45 von Matt Garrish

"Gunnar Hjalmarsson" wrote in message
news:31djm2F3a246vU1@individual.net...
> Matt Garrish wrote:
>> "Joe Blow" wrote in message
>> news:41B0F551.1F3B9FE0@joe.com.ph...
>>
>>>>The following is displayed in the browser if any error occurs within the
>>>>script:
>>>>
>>>>SERVER ERROR
>>>>The server encountered an error .....
>>>>Error message:
>>>>Premature end of script headers: test.cgi
>>
>> Well, the obvious question is are you sending the correct headers?
>
> Not that obvious, since CGI::Carp prints a content-type header. The OP
> also gave the impression that the script normally runs without errors ("if
> any error occurs").
>

Ahh, I didn't read down through the tofu. All I saw was his reply that it's
not working and that he's getting a header error. I'm still suspect as to
what these errors are that he believes should be caught by CGI::Carp.

Matt

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 05.12.2004 04:18:17 von Joe Blow

Gunnar Hjalmarsson wrote:
>
> [ Please do not top-post! ]
>
> Joe Blow wrote:
> >
> > use CGI::Carp qw(fatalsToBrowser)
> >
> > This is not functioning correctly. The outputs don't go to the
> > browser window.
> >
> > Anybody with any hints?
>
> Is CGI::Carp correctly installed? Try this script:
>
> #!/usr/bin/perl
> use CGI::Carp qw(fatalsToBrowser);
> print "Content-type: text/plain\n\n";
> print CGI::Carp->VERSION, "\n";
>
> Are you running under mod_perl?
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl

The output of the above script was 1.24

Re: Use CGI::CARP qw(fatalsToBrowser) not working

am 05.12.2004 09:52:25 von Gunnar Hjalmarsson

Joe Blow wrote:
> Gunnar Hjalmarsson wrote:
>>
>> #!/usr/bin/perl
>> use CGI::Carp qw(fatalsToBrowser);
>> print "Content-type: text/plain\n\n";
>> print CGI::Carp->VERSION, "\n";
>>
>>Are you running under mod_perl?
>
> The output of the above script was 1.24

Can you show us a small script with an error that is not captured by
CGI::Carp as you would have expected?

IIRC, version 1.24 is buggy. It may be worth to try the latest version.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl