Its simple. A module which turns every warning and death into a Carp::confess/cluck style stack trace. Everything, even if the warning or error is generated by Perl. I also want to see function arguments in the stack trace, extremely useful information, which is where all the other Java-esque stack trace modules on CPAN come up short.
I know how to implement it, just a little CORE::GLOBAL and $SIG{__FOO__} magic and let Carp::longmess() take care of the rest. What I don't have is a name. My working title at the moment is Carp::Everywhere. Got a better one?
(Someone please let me know if this module already exists, I don't need to maintain another.)
Would you be thinking of Acme::JavaTrace by any chance? I've never used it myself, but saw a good lightning talk about it at Belfast last year.
Re:Acme strikes again!
schwern on 2005-10-10T23:08:10
It does not show the function arguments.
Re:Devel::StackTrace?
nothingmuch on 2005-10-10T12:19:13
Sorry, I confused myself, I meant Devel::SimpleTraceperl -MDevel::SimpleTrace -e 'sub foo { die }; foo()'
Died
at main::foo(-e:1)
at main::(-e:1)Re:Devel::StackTrace?
grinder on 2005-10-10T15:25:50
That doesn't display the arguments passed to the functions in the caller stack.
Devel::TraceSubs comes closer, but it gets confused if you do odd things with @_. I have a couple of bugs (13287 and 13302) on the issue. I've been trying to find the time to patch it but so far unsuccessful.
Carp::Indeed 0.03
ferreira on 2005-10-10T17:14:08
I've just uploaded to CPAN the release 0.03 which does right a couple of things:$ perl -MCarp::Indeed -e "sub f { die 'horrible death' }; f('a')"
horrible death at -e line 1
main::f('a') called at -e line 1It is not as robust as it should yet, but better. Thanks, Schwern, for reassuring me that longmess() and $SIG{__FOO__} would be good starting points.$ perl -MCarp::Indeed -e "sub f { use strict; my $a; my @a = @$a }; f('a')"
Can't use an undefined value as an ARRAY reference at -e line 1
main::f('a') called at -e line 1Re:Carp::Indeed 0.03
schwern on 2005-10-10T23:13:02
Carp::Indeed 0.03 is indeed doing almost exactly what I want in almost exactly the way I'd written it. Thank you.
Except the name stinks, why did you choose that name? And the documentation is rather ranty... but that's fixable.Re: Carp::Indeed 0.03
ferreira on 2005-10-11T11:25:42
He he he. Well, from my non-native English speaker viewpoint, I even thought it was a good name. Yes, the documentation can be pruned down to a description up to the point. I will work on this. But wrt the name, I don't have a clue for a good name (as you noticed).Re: Carp::Indeed 0.03
grinder on 2005-10-13T13:20:55
Carp::StackTrace would be a good name then. One would already have a pretty good idea what the module does, without opening the documentation.
Re: Carp::Indeed 0.03
schwern on 2005-10-14T23:11:24
Not a very good name if you ask me. The important thing isn't that it allows you to make stack traces, Carp already does that. Its that it allows you to make stack traces everywhere! This is why Carp::Everywhere appeals to me.Re: Carp::Indeed 0.03
grinder on 2005-10-15T08:55:15
Oh right, I forgot that Carp could already do that. Still, I find "Everywhere" has a slightly cutesy ring to it.
- Carp::Detailed
- Carp::Maximum,
::Maximally - Carp::Verbose
Besides, the functionality you want is confess, not carp...
- Confess::Everything
- Confess::Deathbed
Some of my best friends are Catholics. I'll go ask them for some ideas
:) Re: Carp::Indeed 0.03
schwern on 2005-10-17T04:23:03
At what point in this conversation did we stop talking about Perl and switch to Java?Still, I find "Everywhere" has a slightly cutesy ring to it.I kinda like that one. We can add more layers of cultural references...Besides, the functionality you want is confess, not carp...
Confess::Everything
Inquisition::Spanish
Comfy::Chair
Soft::Pillow
You're no fun anymore
n1vux on 2005-10-17T20:21:24
Alas,Monty::Python::Inquisition::Spanish
is where Guido the Parselmouth got his inspiration for thumbscrew indentation, so we loyal camelistas can't even quote the Camel Spotting sketch for fear of endorsing The Other Language.Oh dear, I've gone and quoted it
... I'll have to go outside and turn three times.
</JOKE>
Re:perllexwarn's Fatal Warnings?
schwern on 2005-10-10T23:06:13
Note the remarkable lack of a stack trace. Also, I don't want warnings to die, I just want to be able to more easily diagnose them.$ perl -wle 'use warnings FATAL => qw(all); sub foo { warn "bar" } foo(23);'
bar at -e line 1.
That's not Rentrak code if you wanted to steal it for whatever purpose.use lib '/home/msw';
use MSW::Debug::DieWithCallStack;
$SIG{__WARN__} = $SIG{__DIE__};
Or else, I like hfb's idea.
Devel::Errors::WithStackTrace