Carp::Source

hanekomu on 2007-11-10T10:59:50

I've released Carp::Source. It exports a function, source_cluck(), that does pretty much the same as Carp's cluck() except it also displays the source code context of all call frames, with three lines before and after each call being shown, and the call being highlighted. Enjoy.


Not very useful to me in this form

Aristotle on 2007-11-10T20:51:16

In general I find that I don’t want to decide at the time of writing the code whether a particular instance of croak will dump a stack trace or not. All I can decide is whether to throw an exception or warning in the current context or that of the caller, depending on what makes more sense. Whether to get stack traces or not is something I can only decide when I’m running the code: while investigating a problem, I often want to turn them on globally.

So I love Carp::Always, which makes all warns and dies display a stack trace when it’s enabled. How about making Carp::Source work like that instead of the current “explicit authoring-time request” interface?

Re:Not very useful to me in this form

Aristotle on 2007-11-11T00:05:53

Quick turnaround!

Devel::file similar module

bsb on 2007-11-11T02:46:51

Devel::file is another module doing a similar thing.