Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: "cleaning out" object data

by holli (Monsignor)
on May 20, 2005 at 07: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 07: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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2018-07-16 18:40 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (346 votes). Check out past polls.