Craig,
Thanks 4 ur time.
FYI, here are the versions I have on the server:
CGI.pm : 2.56
CGI/Carp.pm : 1.14
I've done the changes u've suggested, i.e delete the BEGIN block and replace
it with the sub ineval { defined $^S ? $^S : _longmess() =~ /eval
[\{\']/m }.
Exactly the same result.
BTW, I'm not running cgi scripts but mod_perl scripts.
This is a very annoying problem!
So, I think I shall dive into the deepness of TTK.....
kktos.
> It appears you have come across a subtle problem involving perl 5.6.0,
> TT2 and CGI::carp. TT2 exceptions (of any kind, including STOP) do not
> work with CGI::Carp if you are using perl 5.6.0 and CGI.pm >= 2.67 (this
> might be one of the issues in TT2's TODO).
>
> The problem is that between version 2.66 and 2.67 of CGI.pm, CGI/Carp.pm
> changed the definition of "ineval" from:
> - BEGIN {
> - $] >= 5.005
> - ? eval q#sub ineval { defined $^S ? $^S : _longmess() =~ /eval
[\{\']/m }#
> - : eval q#sub ineval { _longmess() =~ /eval [\{\']/m }#;
> - $@ and die;
> - }
>
> to:
>
> + sub ineval { _longmess() =~ /eval [\{\']/m }
>
> Additionally, in perl 5.6.0 the stack trace (from
Carp::Heavy::longmess_heavy)
> used by CGI::Carp returns contains the string "require 0" instead of
> "eval { }" when there is a die() inside an eval{}.
>
> So the ineval() sub in CGI/Carp.pm doesn't think it is inside an
> eval (since it no longer checks ^S) and the exception is not
> dispatched correctly.
>
> Here's an example:
>
> use Carp;
> eval { confess "oops" };
> print $@;
>
> On perl 5.6.0 this prints:
>
> oops at test line 4
> require 0 called at q6 line 4
>
> while on perl 5.6.1 this prints:
>
> oops at q6 line 4
> eval {...} called at q6 line 4
>
> Your problem is solved in perl 5.6.1. Or here's a patch to CGI/Carp.pm
> that should fix the problem too:
>
> - sub ineval { _longmess() =~ /eval [\{\']/m }
> + sub ineval { defined $^S ? $^S : _longmess() =~ /eval [\{\']/m }
>