in reply to UNIVERSAL::isa() vs. ref()

I'm writing to pass me stuff either as a blah or a ref to blah
My first question is: why such flexibility in the API. My comment is: I don't like the way the user has to pass a type and tell you the type. Why don't you simply require that the user pass a reference to the datatype and then your job is easier. Further, there will be no chance of a user making a typographical error such as typing ARRY when he meant ARRAY.

Replies are listed 'Best First'.
Re: Re: UNIVERSAL::isa() vs. ref()
by dragonchild (Archbishop) on Jun 14, 2001 at 18:21 UTC
    Oh, this is a private method. The actual public method would look something like:

    sub my_public { my $self = shift; my @args = $self->coerce_args('ARRAY', @_); .... }
    Or, that could be a hash. The thing was that I couldn't imagine wanting to have anything other than a list(ref) or hash(ref), but I didn't want to limit myself to those, unless those were the only possibilities at all. Maybe I was being too generic?