in reply to weak-reference set internally

Within $bar->a_method() I need to get it's parent Foo object, so get one and store it in $bar->_foo for later possible use.

Why? It sounds like a_method should not belong to the Bar class or Foo class, but your problem is very unclear.

Replies are listed 'Best First'.
Re^2: weak-reference set internally
by Cagao (Monk) on Sep 30, 2010 at 09:15 UTC

    within $bar->a_method, i need to check a property of the parent, ie, in Foo.

    Hence the reason for getting the relevant Foo object, checking it, all good so far, but then want to also keep it for future use in case i need the parent again.

      but then want to also keep it for future use in case i need the parent again.

      So don't use weak references?

        true, but in other cases i may well have created the Foo object outside of the creation of a Bar, and ALSO store it internally within Bar (for ease of use within Bar's methods), hence the reason for the weak-ref.

        This is the issue...