GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Devel::SimpleTrace(3) User Contributed Perl Documentation Devel::SimpleTrace(3)

Devel::SimpleTrace - See where you code warns and dies using stack traces

Version 0.08

On the command-line:

    perl -wMDevel::SimpleTrace program_with_strange_errors.pl

Inside a module:

    use Devel::SimpleTrace;

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 "use"ing 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()".

Options can be set at import time using:

    perl -wMDevel::SimpleTrace=option1,option2

or

    use Devel::SimpleTrace qw(option1 option2);

Available options are:

"showrefs"
Using this option will tell "Devel::SimpleTrace" to stringify objects and references passed in argument to "die()". This option is disabled by default in order to leave objects and references untouched.

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)

Aha! Much better. Finding the bug is now a trivial task ";-)"

Unknown option: %s
(W) This warning occurs if you try to set an unknown option.

This module is currently not compatible with other modules that also work by overriding "die()" and "warn()", like "CGI::Carp".

Sébastien Aperghis-Tramoni <sebastien@aperghis.net>

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.

Devel::SimpleTrace is Copyright (C)2004-2011 Sébastien Aperghis-Tramoni.

This program is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

2011-02-19 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.