[Israel.pm] Returning a copy of an object
Yossi.Itzkovich at ecitele.com
Thu Jun 7 04:06:48 PDT 2007
We have a method that returns a reference to an object, according to a
given parameter (getObjectById(), getObjectByName()). All those objects
are created once in the initializing phase. The method may be called by
a client script, and since the client may change the returned object
(and thus the original object) we decided to return a copy. Those
objects may be from various classes.
Is there a simple && fast way to return a copy (deep copy !) of the
original object ?
We currently use Data::Dump + eval to get a copy, but performance is
bad (we waste more than 10 min, which is 95% of the total time, in that
More information about the Perl