Data::Debug - allows for basic data dumping and introspection.
version 0.03
use Data::Debug; # auto imports debug, debug_warn
use Data::Debug qw(debug debug_text caller_trace);
my $hash = {
foo => ['a', 'b', 'Foo','a', 'b', 'Foo','a', 'b', 'Foo','a'],
};
debug $hash; # or debug_warn $hash;
debug;
debug "hi";
debug $hash, "hi", $hash;
debug \@INC; # print to STDOUT, or format for web if $ENV{REQUEST_METHOD}
debug_warn \@INC; # same as debug but to STDOUT
print FOO debug_text \@INC; # same as debug but return dump
# ALSO #
use Data::Debug qw(debug);
debug; # same as debug
Uses the base Data::Dumper of the distribution and gives it nicer formatting - and allows for calling just about anytime during execution.
Calling Data::Debug::set_deparse() will allow for dumped output of subroutines if available.
perl -e 'use Data::Debug; debug "foo", [1..10];'
See also Data::Dumper.
Setting any of the Data::Dumper globals will alter the output.
Prints out pretty output to STDOUT. Formatted for the web if on the web.
It also returns the items called for it so that it can be used inline.
my $foo = debug [2,3]; # foo will contain [2,3]
Prints to STDERR.
Return the text as a scalar.
Return a plainer string as a scalar. This basically just avoids the attempt to get variable names and line numbers and such.
If passed multiple values, each value is joined by a newline. This has the effect of placing an empty line between each one since each dump ends in a newline already.
If called in void context, it displays the result on the default filehandle (usually STDOUT).
HTML-ized output
Caller trace returned as an arrayref. Suitable for use like "debug caller_trace". This does require at least perl 5.8.0's Carp.
Return truth if a content-type was sent
set $DEPARSE=1
sends the 'text/html' header, properly formatted to whether or not one has been sent
Looks to see if you are in a mod_perl environment, and then retrieve the appropriate apache request object
'Paul Seamons <paul@seamons.com>'
'Russel Fisher <geistberg@gmail.com>'
gbingham <gbingham@bluehost.com>
James Lance <james@thelances.net>
Jason Hall <jayce@lug-nut.com>
This software is copyright (c) 2014 by Paul Seamons.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.