Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Tie & Destroy, OOP

by mothra (Hermit)
on Aug 10, 2001 at 17:17 UTC ( [id://103862]=note: print w/replies, xml ) Need Help??


in reply to Tie & Destroy, OOP

The real problem here is that you're relying on a destructor to do real cleanup work. That's not a good idea because a.) destructors don't always get reliably called, b.) it's possible that you may end up referring to objects in your destructor that have already been destroyed (*ahem* :).

A destructor should be more of a "backup plan" that calls your "cleanup" routine a second time. That is, your "cleanup" rountine should be called at least once by you, and be written in such a way that it won't blow up if it gets called twice (because many times it will get called a second time by your "backup"..the destructor).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found