Re: CGI::Carp and PerlRun

[prev] [thread] [next] [Date index for 2004/12/09]

From: Stas Bekman
Subject: Re: CGI::Carp and PerlRun
Date: 21:04 on 09 Dec 2004
Brian Dimeler wrote:
> Hi,
>  I've noticed that on some of my simpler CGI scripts, in which I use 
> CGI::Carp's 'die' replacement to print an error message to the browser, 
> PerlRun will give an internal server error instead, but still log the 
> error message. These scripts worked fine under mod_cgi. CGI::Carp's 
> documentation claims to have long ago been patched to work with 
> mod_perl, 

I suppose it assumed mod_perl handlers, but may be not PerlRun.

> but for some reason this isn't working for me. Even a very 
> simple example:
> 
> #!/usr/bin/perl -w
> use CGI::Carp 'fatalsToBrowser';
> die 'CGI::Carp test';
> 
> will log this in error_log:
> 
> [Thu Dec  9 10:54:27 2004] [error] PerlRun: `CGI::Carp test at 
> /System/Library/Perl/5.8.1/CGI/Carp.pm line 312.
>
> yet generate a 500 error for the browser (access_log):
> 
> [09/Dec/2004:10:54:27 -0500] "GET /cgi-bin/carptest.pl HTTP/1.1" 500 605
> 
> Does anyone know why this would happen under PerlRun, which is 
> *supposed* to be able to run CGI scripts without modification, and if 
> there's a workaround?

I've tested it and it works fine under Apache::Registry, but not 
Apache::PerlRun. (we are talking modperl1 here I assume). I suppose this 
is because it's run as chunk of code rather than a CODE reference. It's a 
PerlRun.pm problem. Ideally this module should rewritten.

FWIW, I've tested and ModPerl::PerlRun in modperl2 has no problem with it. 
So perhaps you could try to use modperl2 instead.
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution

        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

CGI::Carp and PerlRun
Brian Dimeler 15:59 on 09 Dec 2004

Re: CGI::Carp and PerlRun
Stas Bekman 21:04 on 09 Dec 2004

Generated at 11:27 on 21 Dec 2004 by mariachi v0.52