Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: "cleaning out" object data

by pelagic (Priest)
on May 20, 2005 at 07:36 UTC ( #458867=note: print w/replies, xml ) Need Help??


in reply to "cleaning out" object data

How about:
my $self = shift; $self = ();

pelagic

Replies are listed 'Best First'.
Re^2: "cleaning out" object data
by Forsaken (Friar) on May 20, 2005 at 07:41 UTC
    That was also my first thought, but that:
    - destroys the object if it isn't referenced elsewhere, or
    - does absolutely nothing if it is still referenced elsewhere.

    Basically, as it turns out, all that does is take the variable $self that previously contained a reference to a blessed object, and gives it a new value, a reference to a newly created anonymous hash. So unless $self was the only reference to the object(which it isn't in my specific case) absolutely nothing happens :-)

    edit: formatting

    Remember rule one...

      Yes, of course, you're absolutely right. So I'm afraid your somewhat unelegant solution is the best we can get.

      pelagic
Re^2: "cleaning out" object data
by polettix (Vicar) on May 20, 2005 at 09:52 UTC
    To obtain the requested effect you'd use rev_1318's solution below, i.e. assigning to %$self and not to $self. Typo?

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://458867]
help
Chatterbox?
[mz2255]: I'm trying to post a question to "seekers of perl wisdom" but always getting a permission denied when I want to submit. There are no links in my post...
[ambrus]: again? someone complained about this just a few days ago (although eventually they could post)
[choroba]: Can you post the question in mz2255's scratchpad?
[ambrus]: Corion, if you're here, can you check the spam filter logs to see what's triggering this time?
[ambrus]: Petroza had trouble posting yesterday, but has posted Issues Fetching URL with a variable token since.
[mz2255]: Yes, just edited the scratchpad. Not sure if I'm doing something wrong, it's my first time.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-10-19 15:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (255 votes). Check out past polls.

    Notices?