NAME

Data::Debug - allows for basic data dumping and introspection.

SYNOPSIS

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

DESCRIPTION

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.

SUBROUTINES

debug

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]
debug_warn

Prints to STDERR.

debug_text

Return the text as a scalar.

debug_plain

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).

caller_trace

Caller trace returned as an arrayref. Suitable for use like "debug caller_trace". This does require at least perl 5.8.0's Carp.

AUTHORS

Originally this was borrowed from CGI::Ex (written by Paul Seamons). It has since had many customizations and optimizations by various people.