buff has asked for the wisdom of the Perl Monks concerning the following question:
Honourable Monks,
I'm having troubles using Storable for storing XML::LibXML object. It can store but it can't retrieve! What's more, perl crashes when I try to do it:
$ perl -MXML::LibXML -MData::Dumper -MStorable -e ' $a = XML::LibXML->load_xml(string => "<a></a>"); print Dumper $a; store($a, "tmp"); $b = retrieve "tmp"; print Dumper $b; ' $VAR1 = bless( do{\(my $o = 2150785512)}, 'XML::LibXML::Document' ); $VAR1 = bless( do{\(my $o = 2150785512)}, 'XML::LibXML::Document' ); PmmREFCNT_dec: REFCNT decremented below 0 for 803261e8! during global +destruction. Aborted (core dumped)
I get similar when I try using Dumper instead of Storable. I think it's because of XML::LibXML being XS object and Storable/Dumper only saves pointer to the memory without the actual data. On the other hand, I have no idea how to store / retrieve it correctly.
Dear Monks, do you have any good advice for me?
|
|---|