[plug] perl objects

Matthew Robinson matt at zensunni.org
Thu Jun 10 11:17:10 WST 2004


William Kenworthy wrote:
> How does one dereference a perl object?  I am in need of a new copy (in
> memory) of an object, so I can modify it without affecting the
> original.  Mental block, I cant believe something so simple is so hard
> to find ...
> 
> BillK

What you are trying to do isn't trivial.  It really depends on the 
object you are trying to copy.  The reference is a pointer to a memory 
area, what you are trying to do is a deep clone of the object, this 
requires either knowledge of the internals of the object, help from the 
object to perform the cloning operation or the use of another library 
that can perform deep cloning.

Can you provide more details of the object you are trying to clone.  If 
it is a simple blessed scaler, array or hash it should be relatively 
straightforward.  However, if it is something more complex (such as a 
DBI object) then it will be extremely difficult to clone.

HTH

Matt




More information about the plug mailing list