in reply to Re: How to duplicate objects?
in thread How to duplicate objects?

Clone et al will normally work, but there are some cases where they won't work. Even worse, there are cases where they will partially work in which case you'll get bitten a long way down the line by obscure "can't happen" bugs.

In the general case, you need to use the object's clone() method, and if it doesn't have one - patches welcome!

Replies are listed 'Best First'.
Re^3: How to duplicate objects?
by cramdorgi (Acolyte) on Sep 15, 2008 at 12:59 UTC
    Especially, decide what you want to do with GLOB objects. IIRC, Storable will refuse to clone them, but Clone will do it.
      I was thinking more of objects which really just store a pointer reference to data in global variables - eg, an object might just be a blessed scalar holding an ID, which is then used internally as the key in a global hash. Such techniques are reasonably common.