On Aug 5, 3:00 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote:
> Randal L. Schwartz wrote:
> > You need a destructor when your object holds things that need more care to
> > delete than simply letting the data structure go away.  For example: the
> > object changes need to be saved to disk, or some temporary files are related
> > to the object.
>
> Or you created a cyclic reference and need to break it.  (If you don't know 
> what this is, chances are good you never created one, so don't worry about 
> it.)
>
>
>
> > If that's not the case, you don't need a DESTROY.
>
> > And you never *call* the DESTROY.  Perl calls it when the last reference
> > has been lost.
>
> > Perhaps your program design suffers by having too many globals, and not 
> > enough
> > scope reduction.  Do you have any package variables, or a large number of 
> > "my"
> > variables that live outside all subroutines?
>
> --
> Just my 0.00000002 million dollars worth,
>   Shawn
>
> "For the things we have to learn before we can do them, we learn by doing 
> them."
>   Aristotle

I fixed it!  I see now that I didn't need a destructor, just a cleanup
routine.  There were variables holding information like team ratings,
home team advantages, and things like that which I needed to clear
with a method i called restart().  The program was doing its
calculations starting with the ending state information from the
previous run.  There was one "my" variable that needed to be cleared
also, so thanks for the hint.  No cyclic references (happen to have
just read a little about those).  Thanks again for being so helpful, I
would be stuck on things for weeks without all your answers to my
questions.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to