Hello there monks,

I started using XML::Rabbit a couples of days ago and I quite content with it for reading XML configuration files.

I would like to add some optimization to the program by serializing the objects to the disk and avoid some memory consumption by recovering the values over and over from XML.

The problem is that XML::Rabbit objects do not hold the recovered values from XPath expression in classes attributes. I tried to use a naive approach with Storable but this is what I got from it:

c:\Temp>rabbit.pl Bizarre copy of UNKNOWN in subroutine entry at C:/Perl/site/lib/XML/Li +bXML/XPathContext.pm line 67. PmmREFCNT_dec: REFCNT decremented below 0 for 2ca1798! at C:/Perl/site +/lib/XML/LibXML/XPathContext.pm line 67. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe650! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe638! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe620! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe608! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe5d8! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe5a8! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe5c0! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cbe290! at C:/Perl/site +/lib/XML/LibXML.pm line 1549. PmmREFCNT_dec: REFCNT decremented below 0 for 2cdff18! at C:/Perl/site +/lib/XML/LibXML.pm line 1549.

Considering that XML::Rabbit is Moose based, what do you recommend to use for objects serialization? I thought about cloning the XML::Rabbit objects, saving the values as attributes and keeping the references as necessary, but this looks like a lot of trouble to do it.

Thanks,

Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

In reply to enabling XML::Rabbit serialization by glasswalk3r

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.