[Israel.pm] Returning a copy of an object

Levenglick Dov-RM07994 dovl at freescale.com
Thu Jun 7 04:41:33 PDT 2007

Why not perform a deep copy?!


Best Regards,
Dov Levenglick
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] Freescale General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Proprietary
[x] Personal Memorandum

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Yossi Itzkovich
Sent: Thursday, June 07, 2007 14:07
To: Perl in Israel
Subject: [Israel.pm] Returning a copy of an object


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
copy method).



Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list