in reply to Re: Re: Object identity?
in thread Object identity?

adrianh said I wasn't clear about what this code shows

I meant to say I didn't understand what you were getting at - apologies :-)

If I had a way of comparing past object identity with present objects then I could assert $s1_addr != Class::WeakSingleton->instnace.

If it were me I would check that $s1 had been deallocated using weak references. Something like this example. What you want to test (if I'm reading this correctly) is that the object goes away when it falls out of scope. Having a unique object identifier isn't the only way of doing this.

It turns out that there's a much easier solution which just has me assigning a unique value to each object

Not that this is a bad solution either :-)

Replies are listed 'Best First'.
Re: Re: Re: Re: Object identity?
by diotalevi (Canon) on Jun 20, 2003 at 15:50 UTC

    Correct - I want to know that the object ceases to exist when all the references except the internal Class::WeakSingleton reference are gone. I can always examine the global scalar where the weak reference is expected to be stored but what I wanted to be sure was that a call to ->instance really does return a new object and not just somehow get the old one because I had a typo somewhere.