in reply to Re: Re: Re: Re: dying in the wrong place while using CGI::Carp
in thread dying in the wrong place while using CGI::Carp

While I think that you have stumbled onto an undesirable behavior in CGI::Carp, the bug causing your script to die in the first place is still.... within your script.

However, that said, here's an interesting observation:

With CGI::Carp.....

use CGI::Carp; eval { die "Ouch!" }; print $@, "\n"; __OUTPUT__ Ouch at C:/Perl/lib/CGI/Carp.pm line 312.

With Carp.pm.....

use Carp; eval { die "Ouch" }; print $@, "\n"; __OUTPUT__ Ouch at C:\Perl\scripts\mytest.pl line 6.

And with CORE::die()....

<p> eval { CORE::die "Ouch" } print $@, "\n"; __OUTPUT__ Ouch at C:\Perl\scripts\mytest.pl line 5.

The documentation for CGI::Carp says that in the realm of CGI scripts, you can simply replace "use Carp;" with "use CGI::Carp;". You've discovered that it's not quite that simple... their behavior with respect to reporting a fatal that occurred inside an eval is not uniform.


Dave