in reply to Shorter Carp stack backtrace

I don't think this can be configured — at least not without modifying the source :)

From Carp/Heavy.pm:

sub ret_backtrace { ... my %i = caller_info($i); $mess = "$err at $i{file} line $i{line}$tid_msg\n"; while (my %i = caller_info(++$i)) { $mess .= "\t$i{sub_name} called at $i{file} line $i{line}$tid_ms +g\n"; } return $mess; }

Replies are listed 'Best First'.
Re^2: Shorter Carp stack backtrace
by Anonymous Monk on Apr 16, 2010 at 12:33 UTC
    I agree. Strangely, it won't let me monkeypatch it, such as in:

    sub Carp::Heavy::ret_backtrace{ return 'short...' }

    Don't know why, but it calls its old code. It let's me patch Carp::shortmess though.

    cheers,

    andrea

Re^2: Shorter Carp stack backtrace
by Anonymous Monk on Apr 16, 2010 at 02:28 UTC
    $Carp::CarpLevel?

      How would that change the line format of the backtrace to file:line, as desired?

      #!/usr/bin/perl use Carp 'cluck'; sub foo { bar() } sub bar { baz() } sub baz { cluck "big error!" } foo(); $Carp::CarpLevel = 2; foo(); __END__ big error! at ./834994.pl line 7 main::baz() called at ./834994.pl line 6 main::bar() called at ./834994.pl line 5 main::foo() called at ./834994.pl line 9 big error! at ./834994.pl line 5 main::foo() called at ./834994.pl line 13