summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Guy <mjtg@cam.ac.uk>2001-06-25 12:43:23 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-25 13:56:20 +0000
commit9120d2520b29e2a46667fc6297221b623e70aec3 (patch)
treebae6acb615e558d2f33d07aeb9c7aee284ffcbf1 /lib
parentee964dfe67e839cc40363a15943032d98b77ddcc (diff)
downloadperl-9120d2520b29e2a46667fc6297221b623e70aec3.tar.gz
Re: [PATCH] Re: [ID 20010624.001] debugger T, and Carp::carp don't trace arg of
Message-Id: <E15ETpz-0007AD-00@draco.cus.cam.ac.uk> p4raw-id: //depot/perl@10922
Diffstat (limited to 'lib')
-rw-r--r--lib/Carp.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Carp.pm b/lib/Carp.pm
index 76a6846163..f2e042e05c 100644
--- a/lib/Carp.pm
+++ b/lib/Carp.pm
@@ -21,6 +21,9 @@ confess - die of errors with stack backtrace
use Carp qw(cluck);
cluck "This is how we got here!";
+ print FH Carp::shortmess("This will have caller's details added");
+ print FH Carp::longmess("This will have stack backtrace added");
+
=head1 DESCRIPTION
The Carp routines are useful in your own modules because
@@ -30,6 +33,11 @@ routine Foo() that has a carp() in it, then the carp()
will report the error as occurring where Foo() was called,
not where carp() was called.
+The routine shortmess() can be used to generate the string that
+carp/croak would have produced. The routine longmess() can be
+used to generate the backtrace that cluck/confess would have
+produced.
+
=head2 Forcing a Stack Trace
As a debugging aid, you can force Carp to treat a croak as a confess
@@ -51,11 +59,6 @@ The Carp routines don't handle exception objects currently.
If called with a first argument that is a reference, they simply
call die() or warn(), as appropriate.
-However, rather than duplicating this effort in your own exception
-object, you can access the caller information that croak() would supply
-as shortmess(), and the full stack trace that confess() would generate
-as longmess() (Neither of these are exported by default.)
-
=cut
# This package is heavily used. Be small. Be fast. Be good.