Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: Garbage collected class attributes with inside out classes.

by kyle (Abbot)
on Mar 02, 2007 at 02:55 UTC ( [id://602816]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Garbage collected class attributes with inside out classes.
in thread Garbage collected class attributes with inside out classes.

wouldn't you want the class attributes to exist until the program terminated in case you created a new instance after all the others where destroyed?

In many cases, I'd expect that to be true, yes. Part of my background for this, however, is that one of these class attributes holds a large data structure that I don't want to hold in memory. There could be other reasons for wanting one thing shared by all instances that you also want to deallocate when there are no more instances.

It would seem that its just grabbing the first key in the hash regardless of what it is.

Yes, that's exactly what it does. It finds any other instance of the same class. if there is no other instance, $other_ident will be undef. If there is some other instance, I take a copy of that instance's class attribute reference. Since they all have the same reference, it doesn't matter which one I get.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-20 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found