| Data::Dump - Pretty printing of data structures |
Data::Dump - Pretty printing of data structures
use Data::Dump qw(dump);
$str = dump(@list) @copy_of_list = eval $str;
This module provides a single function called dump() that takes a list
of values as its argument and produces a string as its result. The string
contains Perl code that, when evaled, produces a deep copy of the
original arguments. The string is formatted for easy reading.
If dump() is called in a void context, then the dump is printed on
STDERR instead of being returned.
If you don't like importing a function that overrides Perl's not-so-useful builtin, then you can also import the same function as pp(), mnemonic for ``pretty-print''.
The Data::Dump module grew out of frustration with Sarathy's
in-most-cases-excellent Data::Dumper. Basic ideas and some code are shared
with Sarathy's module.
The Data::Dump module provides a much simpler interface than
Data::Dumper. No OO interface is available and there are no
configuration options to worry about (yet :-). The other benefit is
that the dump produced does not try to set any variables. It only
returns what is needed to produce a copy of the arguments. This means
that dump("foo") simply returns "foo", and dump(1..5) simply
returns (1, 2, 3, 4, 5).
the Data::Dumper manpage, the Storable manpage
The Data::Dump module is written by Gisle Aas <gisle@aas.no>, based
on Data::Dumper by Gurusamy Sarathy <gsar@umich.edu>.
Copyright 1998-2000,2003-2004 Gisle Aas. Copyright 1996-1998 Gurusamy Sarathy.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Data::Dump - Pretty printing of data structures |