Data::Dump - Pretty printing of data structures
use Data::Dump qw(dump); $str = dump(@list) @copy_of_list = eval $str;
This module provide a single function called dump() that takes a list of values as argument and produce a string as result. The string contains perl code that when evaled will produce a deep copy of the original arguments. The string is formatted for easy reading.
eval
If dump() is called in void context, then the dump will be printed on STDERR instead of being returned.
If you don't like to import 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 is shared with Sarathy's module.
Data::Dump
Data::Dumper
The Data::Dump module provide 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. It means that dump("foo") simply returns "foo", and dump(1..5) simply returns (1, 2, 3, 4, 5).
dump("foo")
"foo"
dump(1..5)
(1, 2, 3, 4, 5)
Data::Dumper, Storable
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 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.
To install Data::Dump, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Dump
CPAN shell
perl -MCPAN -e shell install Data::Dump
For more information on module installation, please visit the detailed CPAN module installation guide.