Devel:...eTrace(3pm)
π Devel::SimpleTrace β the manual, but make it slay
okay bestie, gather round π this is Devel::SimpleTrace (you'll see it styled as Devel:...eTrace(3pm) in the wild, and it lives in the User Contributed Perl Documentation section of the perl man pages). It's a perl module, it's tiny, it's powerful, and it will find the exact spot where your code is screaming. no cap.
β¨ NAME β¨
Devel::SimpleTrace β See where you code warns and dies using stack traces π¦
(yes, "you code" β that's literally how it's written, we don't fix, we preserve π )
πΈ VERSION πΈ
Version 0.08
π SYNOPSIS π
From the command-line, just yeet it in there with -M:
perl -wMDevel::SimpleTrace program_with_strange_errors.pl
Or, inside a module, lowkey just:
use Devel::SimpleTrace;
π DESCRIPTION π
So here's the vibe: this module helps you spot the exact place where a program or a module starts generating errors. it's giving "personal detective for your bugs" π
And the way you use it?? Extremely simple. Like, reduced to just useing it. that's the whole thing. iconic behaviour honestly.
The way it works is by modifying the functions warn() and die() so that instead of the standard messages you get complete stack traces that precisely indicate how and where the error or warning happened ππ
Other than that, their use should stay completely unchanged β even when you're using die() inside eval(). fr fr, nothing else shifts.
β¨ OPTIONS β¨
You set options at import time, like this:
perl -wMDevel::SimpleTrace=option1,option2
or this:
use Devel::SimpleTrace qw(option1 option2);
The available options are:
showrefsβ turning this on tellsDevel::SimpleTraceto stringify objects and references that get passed in as an argument todie(). This option is disabled by default, and that's on purpose β it leaves your objects and references untouched until you say otherwise π«Ά
π EXAMPLE π
So HTTP::Proxy version 0.14 was out here suffering from some strange warnings π, and its author Philippe Bruhat was lowkey having a hard time trying to figure out where they could even be coming from. the mystery era.
getsockname() on closed socket Symbol::GEN7 at /System/Library/Perl/darwin/IO/Socket.pm line 186.
Use of uninitialized value in numeric ne (!=) at /Library/Perl/HTTP/Daemon.pm line 53.
Hmm.. like, there's obviously something wrong here, bestie, but spotting the right line?? not easy. not easy at all π
So β re-running the same script, unchanged, just adding -MDevel::SimpleTrace to the perl arguments, produces this:
getsockname() on closed socket Symbol::GEN7
at IO::Socket::sockname(/System/Library/Perl/darwin/IO/Socket.pm:186)
at IO::Socket::INET::sockport(/System/Library/Perl/IO/Socket/INET.pm:231)
at HTTP::Daemon::url(/Library/Perl/HTTP/Daemon.pm:52)
at HTTP::Daemon::ClientConn::get_request(/Library/Perl/HTTP/Daemon.pm:139)
at HTTP::Proxy::serve_connections(/Library/Perl/HTTP/Proxy.pm:500)
at HTTP::Proxy::start(/Library/Perl/HTTP/Proxy.pm:392)
at t::Utils::fork_proxy(t/Utils.pm:72)
at main::(t/50standard.t:138)
Use of uninitialized value in numeric ne (!=)
at HTTP::Daemon::url(/Library/Perl/HTTP/Daemon.pm:53)
at HTTP::Daemon::ClientConn::get_request(/Library/Perl/HTTP/Daemon.pm:139)
at HTTP::Proxy::serve_connections(/Library/Perl/HTTP/Proxy.pm:500)
at HTTP::Proxy::start(/Library/Perl/HTTP/Proxy.pm:392)
at t::Utils::fork_proxy(t/Utils.pm:72)
at main::(t/50standard.t:138)
Aha! Much better π
Finding the bug is now a trivial task ;-) β we love to see it. main character energy for real.
π©Ί DIAGNOSTICS π©Ί
Unknown option: %s
- (W) This warning occurs if you try to set an unknown option. yeah. it said what it said. π
β οΈ CAVEATS β οΈ
Listen bestie, this is important: this module is currently not compatible with other modules that also work by overriding die() and warn(), like CGI::Carp. They're fighting for the same lane and it does NOT end well. π
π AUTHOR π
Sebastien Aperghis-Tramoni <sebastien@aperghis.net>
π BUGS π
Please report any bugs or feature requests to bug-Devel-SimpleTrace@rt.cpan.org, or through the web interface at <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-SimpleTrace>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. we stay in the loop together π«Ά
π COPYRIGHT & LICENSE π
Devel::SimpleTrace is Copyright (C)2004-2011 Sebastien Aperghis-Tramoni.
This program is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π go forth, catch those warnings, and remember β every stack trace is just your code telling you where it hurts. nailed it.
this has been perl v5.36.0, last touched 2022-10-22 β stay hydrated, stay traced, mwah πβ¨
π¦ where this page comes from
- ubuntu noble: libdevel-simpletrace-perl 0.08-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdevel-simpletrace-perl 0.08-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdevel-simpletrace-perl 0.08-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms