in reply to The return value of tie()
As for why it is returning a blessed reference - that's what it supposed to do. That is so you can create a hybrid OO and tied object to do things like:
The uglier way to do that without storing the return value is to do:my $obj = tie my @array, 'My::Class'; $obj->some_method;
It is important to note that you should undef $obj before trying to untie @array. Ultimately the underlying object needn't be the same type as the user sees. If you look under the covers of my Tie::Hash::Sorted, you will see that the hash is really an array under the covers.(tied @array)->some_method();
If you want to post more code of My::Class I would be happy to take a look.
Cheers - L~R
|
|---|