[Israel.pm] Dumping in Perl

Yitzchak Scott-Thoennes sthoenna at efn.org
Tue Feb 20 23:09:42 PST 2007

Yossi Itzkovich wrote:
> I know at least 2 ways to dump data structures in Perl, and then
> "undump" it (A.K.A serialization/Marshaling):
> Data::Dumper
> dumpValue  (dump only)
> Are there additional good alternatives?

Storable is quite nice.  Some people use FreezeThaw.
Data::Dump::Streamer is an improved Data::Dumper, with a slightly
different API and the ability to handle a lot of corner cases that
Data::Dumper doesn't do as well with.

> What are the pros/cons for each one?

Storable is XS (and so often faster than pure perl serializers),
and has an API that makes it easy to read or write to files or
filehandles in addition to strings.  But the resulting data is
binary, and not completely portable from one perl platform to
another (or from one Storable version to another).

Data::Dumper/Data::Dump::Streamer have the flaw that undumping is via
eval, so there's a security risk if the dumped form isn't stored

YAML I dislike for no particular reason, and I've never used FreezeThaw.

Hope this helps,

More information about the Perl mailing list