TODO - add Pod/Pom/Web

NAME

Tree::Navigator::App::PerlDebug - Navigating into memory of a running program

SYNOPSIS

use Tree::Navigator::App::PerlDebug qw/debug/;

... # some code to be debugged

# break here and inspect some data
debug(self => $self, ENV => \%ENV, foo => $some_data);
# now navigate to http:://localhost:5000

... # resume normal operations

DESCRIPTION

This module exports a single function called debug(). Whenever this function is called, the normal program execution flow stops, and a web server is started, that allows you to browse through datastructures and packages. By default, this server is located at http://localhost:5000. When you are done with debugging, click on the "Stop debugging" link, and the program will resume normal execution.

This can also be used from within the Perl debugger : when at some breakpoint, if you want to interactively browse through $self and %ENV, type something like

DB<6> use Tree::Navigator::App::PerlDebug qw/debug/;
DB<7> debug(self => $self, ENV => \%ENV);

and you will see

DEBUG STARTED; USE YOUR WEB BROWSER TO INSPECT self, ENV
HTTP::Server::PSGI::Mortal: Accepting connections at http://0:5000/

Use your favorite Web browser to inspect the data, then click on the "Stop debugging" link, and you are back in the Perl debugger :

END DEBUG SERVER, RESUMING NORMAL OPERATIONS
DB<8> 

FUNCTIONS

debug(name1 => $ref1, name2 => $ref2, ..., \@server_options);

Arguments to debug() are pairs of names and references; names will label the root nodes displayed within the tree navigator, and references are the datastructures to browse.

Optionally, the last argument may be an arrayref of options to be passed to the Web server, using the same syntax as for plackup; in particular, if you want a different port than the default 5000, use

debug(name => $ref, ..., ["--port" => $port_number]);

SEE ALSO

Plack::Runner, plackup

AUTHOR

Laurent Dami, <dami at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2012 Laurent Dami.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.