Elizabeth Mattijsen <[EMAIL PROTECTED]> wrote: > When you use an external library in Perl, such as e.g. libxml, youhave Perl data-structures and libxml data-structures. The Perl> data-structures contain pointers to the libxml data-structures. > In comes the starting of an ithread and Perl clones all of the Perldata-structures. But it copies _only_ does things it knows about. And thus leaves the pointers to the libxml data-structures untouched. Now you have 2 Perl data-structures that point to the _same_ libxml> data-structures. Voila, instant sharing. I see. Our library loading code should take care of that. On thread creation we call again the _init code, so that the external lib can prepare itself to be used from multiple threads. But don't ask me about details ;)
What you need, is basically being able to:
- register a class method to be called on cloning - register an object method that is called whenever an _object_ is cloned
The CLONE sub that Perl5 has, is the class method. The object method is missing from Perl (Thread::Bless is a way to remedy this problem).
I don't know what the _init code does, but judging by its name, its not giving enough info to be able to properly clone an object with external data structures.
Liz