[Israel.pm] Dumping in Perl

Gaal Yahas gaal at forum2.org
Tue Feb 20 23:38:33 PST 2007


On Wed, Feb 21, 2007 at 08:49:59AM +0200, 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
> YAML
> dumpValue  (dump only)
> 
> Are there additional good alternatives?  
> What are the pros/cons for each one?

If you use Storable (which is a good choice where speed matters),
please remember to use the portable C<nstore> method.

YAML has more than one implementation; YAML::Syck is much faster (and
probably closer to spec, too). To write code that transparently uses
whichever module is installed on the user's system, you can use Best:

    use Best qw/YAML::Syck YAML/;

    # http://search.cpan.org/dist/Best/

You can use Data::Serializer to abstract over serialization methods. If
you do this, you can very easily switch around and see what's
applicatively ideal for you:

    http://search.cpan.org/dist/Data-Serializer/

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list