Re: Learning Objects, destroy methods

2004-01-07 Thread Gary Stainburn
On Tuesday 06 January 2004 6:09 pm, Randal L. Schwartz wrote: > > "Gary" == Gary Stainburn <[EMAIL PROTECTED]> writes: > > Gary> My idea is to keep only the %_BLOCKS as a strong ref and weaken > Gary> all others. That way, I can guarantee that when I delete that > Gary> ref the object will be

Re: Learning Objects, destroy methods

2004-01-06 Thread Randal L. Schwartz
> "Gary" == Gary Stainburn <[EMAIL PROTECTED]> writes: Gary> My idea is to keep only the %_BLOCKS as a strong ref and weaken Gary> all others. That way, I can guarantee that when I delete that Gary> ref the object will be destroyed. I do believe you want it the other way around. -- Randal

Re: Learning Objects, destroy methods

2004-01-06 Thread Gary Stainburn
On Tuesday 06 Jan 2004 2:08 pm, Dan Anderson wrote: > I don't know if anybody has mentioned it yet, but check out weak > references on CPAN: > > http://search.cpan.org/~lukka/WeakRef-0.01/WeakRef.pm > > -Dan Thanks Dan, Although, based on experience and responses from this thread I don't think t

Re: Learning Objects, destroy methods

2004-01-06 Thread Dan Anderson
I don't know if anybody has mentioned it yet, but check out weak references on CPAN: http://search.cpan.org/~lukka/WeakRef-0.01/WeakRef.pm -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Learning Objects, destroy methods

2004-01-05 Thread R. Joseph Newton
Gary Stainburn wrote: > On Monday 05 January 2004 2:09 pm, Dan Anderson wrote: > > > My problem is one of destroying a block (object), making sure that I have > > > no memory leakage. > > > > Out of curiosity, when you say memory leakage do you mean that the > > memory persists after the Perl proc

Re: Learning Objects, destroy methods

2004-01-05 Thread R. Joseph Newton
"R. Joseph Newton" wrote: Whoops. Forgot the most important function. Inine > Overall, I would suggest that you steer clear of internal references in your > objects when possible. It is much better to make a container class, then delete > contained objects from the container. Generally you wo

Re: Learning Objects, destroy methods

2004-01-05 Thread Randal L. Schwartz
> "Gary" == Gary Stainburn <[EMAIL PROTECTED]> writes: Gary> I create a new track block such: Gary> my $T1=Trainset->track('T1','Block'); Gary> This also created $Trainset::_BLOCKS{T1} which references the object. Gary> My problem is how can I destroy the object when I no longer want it? Y

Re: Learning Objects, destroy methods

2004-01-05 Thread R. Joseph Newton
Gary Stainburn wrote: > Hi folks, > > My first forrey into Perl objects sees me trying to model a railway. I've got > a hash of named blocks of track, which is added to when I create a new block > object. > > My problem is one of destroying a block (object), making sure that I have no > memory le

Re: Learning Objects, destroy methods

2004-01-05 Thread Rob Dixon
Gary Stainburn wrote: > > On Monday 05 January 2004 3:12 pm, Rob Dixon wrote: > > Gary Stainburn wrote: > [snip] > > > sufficient, or will this still tie up memory? Is there a better way? > > > > Hi Gary. > > > > We really need to see your 'delete' and 'DESTROY' methods. But you can get > > aroun

Re: Learning Objects, destroy methods

2004-01-05 Thread Gary Stainburn
On Monday 05 January 2004 3:12 pm, Rob Dixon wrote: > Gary Stainburn wrote: [snip] > > sufficient, or will this still tie up memory? Is there a better way? > > Hi Gary. > > We really need to see your 'delete' and 'DESTROY' methods. But you can get > around the problem by setting $T1 to anything th

Re: Learning Objects, destroy methods

2004-01-05 Thread Gary Stainburn
On Monday 05 January 2004 2:09 pm, Dan Anderson wrote: > > My problem is one of destroying a block (object), making sure that I have > > no memory leakage. > > Out of curiosity, when you say memory leakage do you mean that the > memory persists after the Perl process exits, or just while it is > ru

Re: Learning Objects, destroy methods

2004-01-05 Thread Rob Dixon
Gary Stainburn wrote: > > My first forrey into Perl objects sees me trying to model a railway. I've got > a hash of named blocks of track, which is added to when I create a new block > object. > > My problem is one of destroying a block (object), making sure that I have no > memory leakage. > > I

Re: Learning Objects, destroy methods

2004-01-05 Thread Dan Anderson
> My problem is one of destroying a block (object), making sure that I have no > memory leakage. Out of curiosity, when you say memory leakage do you mean that the memory persists after the Perl process exits, or just while it is running? And have you verified this? And, is the program a daemon

Learning Objects, destroy methods

2004-01-05 Thread Gary Stainburn
Hi folks, My first forrey into Perl objects sees me trying to model a railway. I've got a hash of named blocks of track, which is added to when I create a new block object. My problem is one of destroying a block (object), making sure that I have no memory leakage. I create a new track block