1Devel::SimpleTrace(3) User Contributed Perl DocumentationDevel::SimpleTrace(3)
2
3
4
6 Devel::SimpleTrace - See where you code warns and dies using stack
7 traces
8
10 Version 0.08
11
13 On the command-line:
14
15 perl -wMDevel::SimpleTrace program_with_strange_errors.pl
16
17 Inside a module:
18
19 use Devel::SimpleTrace;
20
22 This module can be used to more easily spot the place where a program
23 or a module generates errors. Its use is extremely simple, reduced to
24 just "use"ing it.
25
26 This is achieved by modifying the functions "warn()" and "die()" in
27 order to replace the standard messages by complete stack traces that
28 precisely indicates how and where the error or warning occurred. Other
29 than this, their use should stay unchanged, even when using "die()"
30 inside "eval()".
31
33 Options can be set at import time using:
34
35 perl -wMDevel::SimpleTrace=option1,option2
36
37 or
38
39 use Devel::SimpleTrace qw(option1 option2);
40
41 Available options are:
42
43 "showrefs"
44 Using this option will tell "Devel::SimpleTrace" to stringify
45 objects and references passed in argument to "die()". This option
46 is disabled by default in order to leave objects and references
47 untouched.
48
50 For example, "HTTP::Proxy" 0.14 suffered from strange warnings, and its
51 author Philippe Bruhat had a hard time trying to understand where they
52 could come from.
53
54 getsockname() on closed socket Symbol::GEN7 at /System/Library/Perl/darwin/IO/Socket.pm line 186.
55 Use of uninitialized value in numeric ne (!=) at /Library/Perl/HTTP/Daemon.pm line 53.
56
57 Hmm.. There's obviously something wrong here, but spotting the right
58 line is not easy.
59
60 Re-running the same script, unchanged, by just adding
61 "-MDevel::SimpleTrace" to "perl" arguments produces the following
62 output:
63
64 getsockname() on closed socket Symbol::GEN7
65 at IO::Socket::sockname(/System/Library/Perl/darwin/IO/Socket.pm:186)
66 at IO::Socket::INET::sockport(/System/Library/Perl/IO/Socket/INET.pm:231)
67 at HTTP::Daemon::url(/Library/Perl/HTTP/Daemon.pm:52)
68 at HTTP::Daemon::ClientConn::get_request(/Library/Perl/HTTP/Daemon.pm:139)
69 at HTTP::Proxy::serve_connections(/Library/Perl/HTTP/Proxy.pm:500)
70 at HTTP::Proxy::start(/Library/Perl/HTTP/Proxy.pm:392)
71 at t::Utils::fork_proxy(t/Utils.pm:72)
72 at main::(t/50standard.t:138)
73 Use of uninitialized value in numeric ne (!=)
74 at HTTP::Daemon::url(/Library/Perl/HTTP/Daemon.pm:53)
75 at HTTP::Daemon::ClientConn::get_request(/Library/Perl/HTTP/Daemon.pm:139)
76 at HTTP::Proxy::serve_connections(/Library/Perl/HTTP/Proxy.pm:500)
77 at HTTP::Proxy::start(/Library/Perl/HTTP/Proxy.pm:392)
78 at t::Utils::fork_proxy(t/Utils.pm:72)
79 at main::(t/50standard.t:138)
80
81 Aha! Much better. Finding the bug is now a trivial task ";-)"
82
84 Unknown option: %s
85 (W) This warning occurs if you try to set an unknown option.
86
88 This module is currently not compatible with other modules that also
89 work by overriding "die()" and "warn()", like "CGI::Carp".
90
92 Sébastien Aperghis-Tramoni <sebastien@aperghis.net>
93
95 Please report any bugs or feature requests to
96 "bug-Devel-SimpleTrace@rt.cpan.org", or through the web interface at
97 <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-SimpleTrace>.
98 I will be notified, and then you'll automatically be notified of
99 progress on your bug as I make changes.
100
102 Devel::SimpleTrace is Copyright (C)2004-2011 Sébastien Aperghis-
103 Tramoni.
104
105 This program is free software. You can redistribute it and/or modify it
106 under the same terms as Perl itself.
107
108
109
110perl v5.32.1 2021-01-27 Devel::SimpleTrace(3)