At 04:17 PM 8/8/00 -0500, Garrett Goebel wrote:
>Here's a version of my own kludgey deep copy. -Updated to use our mythical
>->CLONE method, and watch for circular references...
Great stuff, I've put it in v2.
>[snip]
> : /^CODE$/ ? $_[0] # " (B::Deparse)
>[snip]
>I would like deep copying to include copying CODE. It would be useful for
>implementing object methods...
Why would it be necessary to deep copy a CODE reference?
> > =head2 Filehandles
> >
> > If C<clone> encounters an C<IO::Handle>, its default behavior
> > will be to make a copy of the filehandle (debatable: perhaps
> > the default should be to throw an exception) unless a C<CALLBACK>
> > function was specified
>
>Doesn't this fall under $obj->CLONE?
IO::Handle appears to be what the builtin filehandles are these days (I'm
trying to keep up; IO::Handle is mentioned in Camel III under ref(), but
5.6.0 filehandles still say GLOB - hmm, mebbe IO::Handle is just for
sockets...). Either way, yes, CLONE would or could be a method of the
IO::Handle class but I wanted to make it explicit.
>Speaking of UNIVERSAL::CLONE is it really more complicated than a special
>case of the above dcopy subroutine?
Nope, it would indeed call that subroutine and not much else. But I think
dcopy/clone will end up being an internal, not Perl code.
--
Peter Scott
Pacific Systems Design Technologies