>> Hmm.. Yes, it sounds pretty sketchy to me too!  Immediately what I am
>> playing with is the idea of keeping parsed XML (XML::LibXML)in memory
>> between requests.  Is this a completely barmy idea?

> Probably, because you'll confuse XML::LibXML's garbage collector.

Sniff..  I've kind of got something working... Enough such that one
httpd can request an XYZ, and if a second httpd comes along a little
later and requests the same XYZ then it will get it from shared memory..
There's a max limit, and when that's reached the oldest XYZ is rotated
out in favor of the new one.

The 'XYZ' can be a string, hash, array, object etc (as far as I've
tried) by using Storable.. to serialize it.. 

As expected though.. trying to do this with LibXML objects fails.. a
lot.

What I thought was that if I kept the handle to the parsed XML open
somewhere else then I would be able to use it.. so a separate process
does the parsing and keeps hold of the handles of the currently 'shared'
bits of XML..  What comes out the other end is something along the lines
of:

        bless( do{\(my $o = 137110200)}, 'XML::LibXML::Document' )

But trying to toString() it for instance gives me a :

        XML::LibXML::Document::_toString() -- self contains no data at
[snip]/LibXML.pm line 659.

(Incidentally, the XML can be happily toString'ed from the process that
originally parsed it, long after.. so I know it's still lurking about
somewhere..)

To what does the "my $o = 137110200" refer?  Is there no way I can get
the parsed object out of LibXML2 into another process?  

CAVEAT : I know it's probably looked at as a silly idea, but if I could
keep my parsed stylesheets/xml's shared somewhere I'd save my self
having to re-parse for every request wouldn't I? . . 

ATB,

Jimbo 




Reply via email to