in reply to Re: "Is it a hashref" vs "Can I use it like a hashref?"
in thread "Is it a hashref" vs "Can I use it like a hashref?"
The documentation for HTML::Template says to pass it in hashrefs, etc -- "plain old reference" datastructures. But blessed objects can be used seamlessly as "plain old reference" datastructures, either by being the correct type of blessed reference, or by overloading the appropriate dereferencing operators. I'm just suggesting a more complete way of checking for the type of a datastructure that includes these possibilities.
It's like writing a sub that requires a scalar, so you have some code to verify the input is a scalar. But the verification code fails for a tied scalar. That would be ridiculous. We have tied objects so we can use the "plain old variable" interface seamlessly. We also have the ability to overload dereferencing operators -- for what other reason than to use the "plain old reference" interface?
blokhead
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: "Is it a hashref" vs "Can I use it like a hashref?"
by BUU (Prior) on Jan 20, 2004 at 00:31 UTC |