|Problems? Is your data what you think it is?|
Re: Blessing tied hashby davido (Archbishop)
|on May 05, 2012 at 15:36 UTC||Need Help??|
As has been mentioned, a hash itself cannot be blessed, but a hashref (including a tied one) can. However, I wanted to add that there is another abstraction already available when a hash gets tied.
Let's tie %hash:
tie has a return value...
Now what you're proposing is that the reference to %hash also be blessed:
These are two different objects, tied to two very different classes. $tied_object could, for example, explicitly call FETCH(), and may call any other methods built into MyClass. On the other hand, $instance can call any methods from MyOtherClass. Neither one of them has any direct access to the other; they're two separate objects.
As authors (which I'm not) often say, "The implementation and application to real world problems is left as an exercise for the reader."
Now according to perltie, the object reference returned by tie doesn't even have to be a reference to an object of