1Carp::Always(3) User Contributed Perl Documentation Carp::Always(3)
2
3
4
6 Carp::Always - Warns and dies noisily with stack backtraces
7
9 use Carp::Always;
10
11 makes every "warn()" and "die()" complains loudly in the calling
12 package and elsewhere. More often used on the command line:
13
14 perl -MCarp::Always script.pl
15
17 This module is meant as a debugging aid. It can be used to make a
18 script complain loudly with stack backtraces when warn()ing or
19 die()ing.
20
21 Here are how stack backtraces produced by this module looks:
22
23 # it works for explicit die's and warn's
24 $ perl -MCarp::Always -e 'sub f { die "arghh" }; sub g { f }; g'
25 arghh at -e line 1
26 main::f() called at -e line 1
27 main::g() called at -e line 1
28
29 # it works for interpreter-thrown failures
30 $ perl -MCarp::Always -w -e 'sub f { $a = shift; @a = @$a };' \
31 -e 'sub g { f(undef) }; g'
32 Use of uninitialized value in array dereference at -e line 1
33 main::f('undef') called at -e line 2
34 main::g() called at -e line 2
35
36 In the implementation, the "Carp" module does the heavy work, through
37 "longmess()". The actual implementation sets the signal hooks
38 $SIG{__WARN__} and $SIG{__DIE__} to emit the stack backtraces.
39
40 Oh, by the way, "carp" and "croak" when requiring/using the "Carp"
41 module are also made verbose, behaving like "cloak" and "confess",
42 respectively.
43
44 EXPORT
45 Nothing at all is exported.
46
48 This module was born as a reaction to a release of Acme::JavaTrace by
49 Sebastien Aperghis-Tramoni. Sebastien also has a newer module called
50 Devel::SimpleTrace with the same code and fewer flame comments on docs.
51 The pruning of the uselessly long docs of this module were prodded by
52 Michael Schwern.
53
54 Schwern and others told me "the module name stinked" - it was called
55 "Carp::Indeed". After thinking long and not getting nowhere, I went
56 with nuffin's suggestion and now it is called "Carp::Always".
57 "Carp::Indeed" which is now deprecate lives in its own distribution
58 (which won't go anywhere but will stay there as a redirection to this
59 module).
60
62 · Carp
63
64 · Acme::JavaTrace and Devel::SimpleTrace
65
66 Please report bugs via CPAN RT
67 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Carp-Always.
68
70 Every (un)deserving module has its own pet bugs.
71
72 · This module does not play well with other modules which fusses
73 around with "warn", "die", $SIG{'__WARN__'}, $SIG{'__DIE__'}.
74
75 · Test scripts are good. I should write more of these.
76
77 · I don't know if this module name is still a bug as it was at the
78 time of "Carp::Indeed".
79
81 Adriano Ferreira, <ferreira@cpan.org>
82
84 Copyright (C) 2005-2007 by Adriano R. Ferreira
85
86 This library is free software; you can redistribute it and/or modify it
87 under the same terms as Perl itself.
88
89
90
91perl v5.12.1 2007-07-30 Carp::Always(3)