Dean Arnold wrote: > Alas, there's one catch that the current T::Q > implementation doesn't cover: recursive structures:
Oh, crud. Thanks for catching that. > Or maybe using a fieldhash to key the original ref thats > being cloned, do a quick lookup, and if it exists, then > skip it That was my thought, too. I'll work on it. > Momentary insanity: Why not reuse the existing perl_clone > code ? Egads! I've no clue about this. > Would an assignment op overload work? I.e., if the LHS > was already shared(), then the = overload would do the > deepcopy? Or would that break the XS tie/magic side of the > code? I had the same idea. I can't think of why it might conflict with anything the XS code does (but that thought doesn't have much to back it up). What are your thoughts regarding structures that mix shared and non-shared elements? Should a whole separate clone be made, or should that shared portions (i.e., refs) be used in the copy? (I'm thinking the latter, while messier, makes more sense.)