This module can be used to more easily spot the place where a program or a module generates errors. Its use is extremely simple, reduced to just useing it.

This is achieved by modifying the functions warn() and die() in order to replace the standard messages by complete stack traces that precisely indicates how and where the error or warning occurred. Other than this, their use should stay unchanged, even when using die() inside eval().

For example, HTTP::Proxy 0.14 suffered from strange warnings, and its author Philippe Bruhat had a hard time trying to understand where they could come from.

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.. There's obviously something wrong here, but spotting the right line is not easy.

Re-running the same script, unchanged, by just adding -MDevel::SimpleTrace to perl arguments produces the following output:

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)