Dave Mitchell wrote:
On Thu, Apr 07, 2005 at 10:21:51AM -0400, Stas Bekman wrote:

Nicholas Clark wrote:

Does this differ at all in functionality from the proposal to pass an array
(or arrayref) of all objects of a class as an argument to the CLONE method?

IIRC the ithreads clone code is pretty much already tracking this information.

Cool. Can we have it? Let me know if you need help working on it. I'd rather spend time improving it, than using the current CLONE. And I'd really hope to see it in 5.8.7, otherwise we won't have a perl-thread-safe mp2 until the next release.



I thought that there would be problems with subclasses that don't override
the CLONE method, but there isn't - if Bar is a subclass of Foo, then
Foo->CLONE([EMAIL PROTECTED]) is called for all the Foos, and Bar->CLONE([EMAIL PROTECTED]) is called
for all the Bars.


For the specific case of mod_perl, would it be more useful / efficient
instead to have a C-level hook; eg register a C-level function to be
called each time an object is cloned? Or perhaps have a new 'clone' magic
type that can be attached to an SV which points to a cloning callback
function ???

Well, that's exactly what I'm asking for :)

Stas, I don't know what specific activity you need to carry out during
cloning, so I'm just vaguely hand-waving here. In particular I don't know
whether you need to call Perl or C code.

C code is fine since anybody needing to handle CLONE already has C code to deal with.


Anyway, I've got some spare time at the moment, so I might be volunteering
to take this on (assuming we can all agree on the interface !)

Dave++!

I thought to call it as it finds objects
http://paste.husk.org/2949, but I get segfaults:
http://paste.husk.org/2950.

As Nicholas suggests that's too early to call. So we now talk about the following scenario:

make a hash:
  object => rv

and then CLONE those where CLONE is calle now. the hash is needed to avoid dups where more than one rv points to the same object.

Any chance you can join #p5p, we discuss it at this very moment. Thanks.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to