I happened to be checking 'perldoc Carp' for Carp::longmess, which I've always used, and noticed the documentation is not there in the latest Perl. In fact the documentation was removed in 5.8.9 in commit d735c2e in a patch from Ben Tilly <ben_tilly@operamail.com> 2006-10-22 07:07:23.

Apparently he didn't like because the stack trace is off by one:

- Removed documentation of shortmess and longmess. Unfortunately longmess doesn't do anything particularly reasonable, and it can't be made to do so because of backwards compatibility with code that depended on the old behaviour. http://www.nntp.perl.org/group/perl.perl5.porters/2006/10/msg117394.html

Does anybody else find that "doesn't do anything particularly reasonable" little extreme? longmess() gives a perfectly good stacktrace up to your current method. He doesn't go so far as to deprecate it though, he just removed the pod. What are other people using to get a stacktrace as a string, these days then?

$ perl test.pl stacktrace leading to fourth at test.pl line 10 main::third() called at test.pl line 7 main::second() called at test.pl line 4 main::first() called at test.pl line 16 dying in fourth at test.pl line 14 main::fourth() called at test.pl line 10 main::third() called at test.pl line 7 main::second() called at test.pl line 4 main::first() called at test.pl line 16 $ cat -n test.pl 1 use Carp; 2 3 sub first { 4 second(); 5 } 6 sub second { 7 third(); 8 } 9 sub third { 10 fourth(); 11 } 12 sub fourth { 13 print STDERR Carp::longmess('stacktrace leading to fou +rth'); 14 Carp::confess("dying in fourth"); 15 } 16 first();

In reply to is Carp::longmess deprecated? by kgoess

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.