* Linda A. Walsh <perl-didd...@tlinx.org> [2013-11-14 04:25]:
>  Which would at least have looked better as:
>
> elseif(SCALAR $refx || REF $refx)...
> elsif (HASH $refx)...

https://metacpan.org/pod/Params::Util --- Use that.

There you go. Thread solved.

> sub ARRAY (;$) {my $p = $_[0]; my $t='ARRAY';
>    return @_ ? ref $p eq $t : $t;  }
>  sub HASH (;$) { my $p = $_[0]; my $t='HASH';
>    return @_ ? ref $p eq $t : $t;  }
>  sub SCALAR (;$) {my $p = $_[0]; my $t='SCALAR';
>    return @_ ? ref $p eq $t : $t;  }

Params::Util’s has better checks than those. (In terms of what it
checks. Not the level of copy&paste, which doesn’t matter.)

Its name is better too.

You’ll do your other code a favour by adopting it and dropping your own
Types.pm.

> So far the people who have not wanted it at the top level said that
> before even knowing what it did.

And having seen what it does, that opinion stands.

If non-toplevel is good enough for Params::Util and Adam Kennedy then
it’s good enough for you.

Which – surprise – to people with experience was predictable before they
saw your code.

> I don't think they'll change their minds, but who knows?

That’s OK, you won’t change your mind either.

-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to