I need a module name.

schwern on 2005-10-10T11:17:18

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.)


Acme strikes again!

barbie on 2005-10-10T11:37:08

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.

Devel::StackTrace?

nothingmuch on 2005-10-10T11:46:35

http://search.cpan.org/user/drolsky/Devel-StackTrace-1.12/lib/Devel/StackTrace.pm

Re:Devel::StackTrace?

nothingmuch on 2005-10-10T12:19:13

Sorry, I confused myself, I meant Devel::SimpleTrace
perl -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.

funny name

uwevoelker on 2005-10-10T13:21:25

I would call it Carp::Enter :-)

What about Carp::Indeed ?

ferreira on 2005-10-10T13:22:27

I wrote such a module recently. I've called it Carp::Indeed and it uses import()> with CORE::GLOBAL::die() and CORE::GLOBAL::warn() to make it work. To be really honest, this current implementation does not work all the time. I thought about changing the implementation to use $SIG{__FOO__} stuff (which is probably even shorter than the current one - around ten lines of code), but I didn't made the time for this yet. Acme::JavaTrace inspired me.

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 1
$ 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 1
It 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.

Re: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

Still, I find "Everywhere" has a slightly cutesy ring to it.
At what point in this conversation did we stop talking about Perl and switch to Java?
Besides, the functionality you want is confess, not carp...
 
    Confess::Everything
I kinda like that one. We can add more layers of cultural references...

        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>

perllexwarn's Fatal Warnings?

sjn on 2005-10-10T14:01:17

Would

    use warnings FATAL => qw(all);

do something useful for you?

Re:perllexwarn's Fatal Warnings?

schwern on 2005-10-10T23:06:13

$ perl -wle 'use warnings FATAL => qw(all);  sub foo { warn "bar" }  foo(23);'
bar at -e line 1.
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.

If you're on edev1

wickline on 2005-10-10T14:04:19

use lib '/home/msw';
use MSW::Debug::DieWithCallStack;
$SIG{__WARN__} = $SIG{__DIE__};
That's not Rentrak code if you wanted to steal it for whatever purpose.

what about

hfb on 2005-10-10T21:25:38

Carp::ChickenLittle

Carp::LikeCrazy?

jdavidb on 2005-10-10T23:13:06

Or else, I like hfb's idea.

Carp::Ability

jmm on 2005-10-11T14:34:37

To point out the guilty party (culpability).

just a few

WebDragon on 2005-10-11T15:43:08

Carp::Tacular ? :)

Carp::Vomit :D
Carp::TheWhole9Yards

ok enough silliness, what about Carp::StackTrace?

how about...

da on 2005-10-11T23:38:30

Carp::More

Carpe'Diem

:)

How about ...

drhyde on 2005-10-12T11:14:57

Devel::Errors::WithStackTrace