kgoess has asked for the wisdom of the Perl Monks concerning the following question:
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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: is Carp::longmess deprecated?
by kcott (Archbishop) on Nov 29, 2010 at 19:05 UTC | |
by kgoess (Beadle) on Nov 29, 2010 at 20:02 UTC | |
by kcott (Archbishop) on Nov 30, 2010 at 06:06 UTC | |
|
Re: is Carp::longmess deprecated?
by jettero (Monsignor) on Nov 29, 2010 at 18:20 UTC | |
by kgoess (Beadle) on Nov 29, 2010 at 19:54 UTC | |
|
Re: is Carp::longmess deprecated?
by tilly (Archbishop) on Jan 18, 2011 at 23:10 UTC | |
by Anonymous Monk on Nov 18, 2011 at 19:55 UTC | |
by Anonymous Monk on Nov 15, 2011 at 00:25 UTC |