On Mon, Sep 13, 2010 at 08:00:01AM +0200, Johan Vromans wrote:
> Aristotle Pagaltzis <pagalt...@gmx.de> writes:
> > You don???t want to reach inside an object just
> > because it happens to be hash-based.
> Interesting. For Getopt::Long (that can take an optional hashref as its
> first argument) I got explicit requests from users to allow hash based
> objects as well.

If you document that your function takes a hash-ref argument, your users
should expect you to try to reach inside it.  To say that you shouldn't
if you're passed a hash-based object smacks of stupid parroting of
religious dogma.

However, the best way to see if what you've been passed is a hashref is
to try de-referencing it, not to use isa()).  That would allow a non-
hash-based object to behave as one if it provides the appropriate
overloading.

-- 
David Cantrell | Enforcer, South London Linguistic Massive

The children now love luxury; they have bad manners, contempt for
authority; they show disrespect for elders and love chatter in place
of exercise. Children are now tyrants, not the servants of their
households. They no longer rise when elders enter the room. They
contradict their parents, chatter before company, gobble up dainties
at the table, cross their legs, and tyrannize their teachers.
    -- attributed by Plato to Socrates

Reply via email to