NAME

Data::NeatDump - stringified perl data structures for human eyes


SYNOPSIS

    use Data::NeatDump;
    print dump([1, 2, [ 3, 4 ]], { 'a' .. 'z' }, 42);

or:

    use Data::NeatDump;
    set_dump_indent_size(3);
    set_dump_level_limit(4);
    set_dump_array_limit(8);
    set_dump_line_prefix("| ");
    set_dump_type_naming(1);
    set_dump_quotes_mode(1);
    my $output = Dump($var1, $var2);

or:

    use Data::NeatDump qw(:informative :perl Dump);

or:

    use Data::NeatDump (quotes_mode => 2, indent_size => 2);


DESCRIPTION

Given a list of scalars or references or objects, writes out their contents in human readable form. The reference type (like ``ARRAY'', ``HASH'') and object type (like ``Dog'', ``Podius::Component'') is shown in the output, as well as the recursive content.

The main function is available under several names: dump (be aware that there is a standard perl function of this name, but it is masked), Dump and get_data_dump. Also it is optionally available under name perl (should be imported explicitly).

Note, this module is not indented to be used for perl data serialization.


FUNCTIONS

The following functions are exported by default:

dump, Dump, get_data_dump, print_data_dump, set_dump_indent_size, set_dump_level_limit, set_dump_array_limit, set_dump_line_prefix, set_dump_type_naming, set_dump_quotes_mode.

Modules may request importing only one function, say Dump or perl.

dump data ...
Dump data ...
Return a (possibly multi-line) string representation of all arguments.

set_dump_indent_size num
set_dump_level_limit num
set_dump_array_limit num
set_dump_line_prefix str
set_dump_type_naming bool
set_dump_quotes_mode 1|2|3
These funtions control the behaviour of get_data_dump. The defaults are to use 2 spaces for level indentation, to delve into 10 levels only, and to show 20 first elements of array only. The informative ellipsys is shown when some levels or elements are skipped in the output.

There is no line prefix by default, but it may be set (try ``[dump] ''). Also, by default hashs and arrays are not prefixed with strings like ``HASH '', you may turn it on. The quotes around values may be controlled by setting mode 1 (don't quote numbers and keys if possible), 2 (don't quote numbers) and 3 (always use quotes).


AUTHORS

Mikhael Goikhman (migo@cpan.org)


SEE ALSO

For a more serialization-like functionality, see the Data::Dumper manpage.