[Catalyst] Re: Perl::Rails?

Brandon Black blblack at gmail.com
Fri Dec 9 22:49:59 CET 2005


On 12/9/05, Brandon Black <blblack at gmail.com> wrote:
> On 12/9/05, Sebastian Riedel <sri at oook.de> wrote:
> >
> > 09.12.2005 17:48 Brandon Black:
> > > Except that not every CPAN module one might use uses carp/croak.  Some
> > > just die on error.
> >
> > We can't solve the problems of every module on CPAN.
> > But in fact, the only problem are modules that die with a newline
> > (die "foo\n").
> >
>

I've upgraded to 5.61 now, and I still see the same problems.  Even
"die" from a CPAN module that does not have a "\n" on the end doesn't
provide a stack trace.  Maybe we're talking about two different
things.

If my controller code uses a random CPAN module, and that module does
a "die 'foo';" somewhere inside itself, Catalyst says:

[Fri Dec  9 15:37:06 2005] [catalyst] [error] Caught exception "foo at
/path/to/Module.pm line 345"

But does not provide stack context for what part of my controller code
I was in when this error occured.

AFAIK, there is no way to get such a context without overriding
CORE::GLOBAL::die or $SIG{__DIE__}, and then it becomes a little bit
tricky to not mess up eval {}'s and such, but it can be done by
examining $^S and/or the caller() stack.

I know it's not Catalyst's responsibility to clean up the mess left
behind by module authors who used die when they should have been using
croak, but it is still a real practical problem in debugging Catalyst
apps at times, which could be solved with a more advanced (and
neccesarily complicated) approach to exception handling.

-- Brandon



More information about the Catalyst mailing list