Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: "cleaning out" object data

by holli (Monsignor)
on May 20, 2005 at 03:48 UTC ( #458870=note: print w/replies, xml ) Need Help??

in reply to "cleaning out" object data

You could simply bless an empty hash with the classname of the object.
$obj = bless {}, ref($obj);

holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: "cleaning out" object data
by Forsaken (Friar) on May 20, 2005 at 03:58 UTC
    That would make $obj point to a new object within its own scope, but all other references to the original object would still be intact, as would the data stored in the original object. I'll make a small example in the OP to clarify.

    Remember rule one...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://458870]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2018-10-23 23:05 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (126 votes). Check out past polls.