in reply to Re: Is it possible to obtain all hardreferences to some memory address by knowing only one of them?
in thread Is it possible to obtain all hardreferences to some memory address by knowing only one of them?

How can I weaken reference ($copy in example above) if i don't know about it existence? Is it possible to obtain all references that refer to specified object?
  • Comment on Re^2: Is it possible to obtain all hardreferences to some memory address by knowing only one of them?

Replies are listed 'Best First'.
Re^3: Is it possible to obtain all hardreferences to some memory address by knowing only one of them?
by Joost (Canon) on Feb 07, 2007 at 18:15 UTC
    How do you know there are references then?

    Please explain why you'd want to do this, because you're trying to do something that you'd normally never want to do, and perl is in fact designed to stop you doing this.

    Any way, if i had to, I'd probably resort to Tie::Scalar to fake a reference and return weak-references whenever someone tries to copy it*). Very non-intuitive, slow and confusing, but at least sort of portable. Also, that way you could throw some stack-traces to STDERR to see where the **** your references get copied.

    *) now that I think about it, I'm not even sure that would work.

Re^3: Is it possible to obtain all hardreferences to some memory address by knowing only one of them?
by phaylon (Curate) on Feb 07, 2007 at 15:54 UTC
    Btw, what's the reason you are trying to do this? This smells like a bug in your application design to me.

    Ordinary morality is for ordinary people. -- Aleister Crowley
      it is not my application and design )
      the question is: Does it possible to obtain all hard references to one object by knowing only one of these references?