The following short script will crash almost any XS module you care to try it with:
my $xsmodule = 'Image::PNG::Libpng';
eval "use $xsmodule";
my $iv = 1;
my $ivref = \$iv;
bless $ivref, $xsmodule;
Change $iv to a random number or zero if you like, and change $xsmodule to whatever you like.
Unbelievably, this is what Storable actually seems to do:
use Storable qw/thaw freeze/;
my $xsmodule = 'JSON::XS';
eval "use $xsmodule;\$thing = $xsmodule->new ()";
thaw (freeze (\$thing));
This module has been around since 1995 and it's part of the Perl core.
Balancing previous glowing reviews. Storable has it faults, for example historically its track record for file format backwards compatibility is poor, making programs fail when loading Storable files after the module is upgraded.
Also, more importantly, add builtin support for Regexp object already! It's almost 2013, Regexp object has been around for, what, more than a decade? I can understand not supporting serializing filehandle or coderef, but Regexp object?
I used to be quite happy using Data::Dumper to spit out a perl data structure into a file and then require it back in. After a while I found this blew up on big multi-level hashes and the performance was truly horrifying. A little bit of searching let to Storable. Thank goodness. It reads and writes mammoth structures in a flash and the interface is spiffy clean. Now almost every non-trivial site I've written has used Storable to import data painlessly.