1Carp::Always(3)       User Contributed Perl Documentation      Carp::Always(3)
2
3
4

NAME

6       Carp::Always - Warns and dies noisily with stack backtraces
7

SYNOPSIS

9         use Carp::Always;
10
11       Often used on the command line:
12
13         perl -MCarp::Always script.pl
14

DESCRIPTION

16       This module is meant as a debugging aid. It can be used to make a
17       script complain loudly with stack backtraces when warn()ing or
18       die()ing.
19
20       Here are how stack backtraces produced by this module looks:
21
22         # it works for explicit die's and warn's
23         $ perl -MCarp::Always -e 'sub f { die "arghh" }; sub g { f }; g'
24         arghh at -e line 1
25                 main::f() called at -e line 1
26                 main::g() called at -e line 1
27
28         # it works for interpreter-thrown failures
29         $ perl -MCarp::Always -w -e 'sub f { $a = shift; @a = @$a };' \
30                                  -e 'sub g { f(undef) }; g'
31         Use of uninitialized value in array dereference at -e line 1
32                 main::f('undef') called at -e line 2
33                 main::g() called at -e line 2
34
35       In the implementation, the Carp module does the heavy work, through
36       "longmess()". The actual implementation sets the signal hooks
37       $SIG{__WARN__} and $SIG{__DIE__} to emit the stack backtraces.
38
39       Also, all uses of "carp" and "croak" are made verbose, behaving like
40       "cluck" and "confess".
41

METHODS

43       Carp::Always implements the following methods.
44
45   import
46         Carp::Always->import()
47
48       Enables Carp::Always. Also triggered by statements like
49
50         use Carp::Always;
51         use Carp::Always 0.14;
52
53       but not by
54
55         use Carp::Always ();    # does not invoke import()
56
57   unimport
58         Carp::Always->unimport();
59
60       Disables Carp::Always. Also triggered with
61
62         no Carp::Always;
63

ACKNOWLEDGMENTS

65       This module was born as a reaction to a release of Acme::JavaTrace by
66       Sébastien Aperghis-Tramoni.  Sébastien also has a newer module called
67       Devel::SimpleTrace with the same code and fewer flame comments on docs.
68       The pruning of the uselessly long docs of this module was prodded by
69       Michael Schwern.
70
71       Schwern and others told me "the module name stinked" - it was called
72       "Carp::Indeed". After thinking long and getting nowhere, I went with
73       nuffin's suggestion and now it is called "Carp::Always".
74

SEE ALSO

76       Carp
77
78       Acme::JavaTrace and Devel::SimpleTrace
79
80       Carp::Always::Color
81
82       Carp::Source::Always
83
84       Devel::Confess
85
86       Carp::Always::SyntaxHighlightSource and Carp::Always::DieOnly
87

BUGS

89       ·   This module does not play well with other modules which fusses
90           around with "warn", "die", $SIG{__WARN__}, $SIG{__DIE__}.
91
92       ·   Test scripts are good. I should write more of these.
93
94       Please report bugs via GitHub
95       <https://github.com/aferreira/cpan-Carp-Always/issues>
96
97       Backlog in CPAN RT:
98       <https://rt.cpan.org/Public/Dist/Display.html?Name=Carp-Always>
99

AUTHOR

101       Adriano Ferreira, <ferreira@cpan.org>
102
104       Copyright (C) 2005-2013, 2018 by Adriano Ferreira
105
106       This library is free software; you can redistribute it and/or modify it
107       under the same terms as Perl itself.
108
109
110
111perl v5.32.0                      2020-07-28                   Carp::Always(3)
Impressum