http://www.perlmonks.org?node_id=391931


in reply to Re: Being more Assert-ive with Perl
in thread Being more Assert-ive with Perl

Perhaps instead of using ref you should check out Scalar::Util's reftype?

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
Re^3: Being more Assert-ive with Perl
by ysth (Canon) on Sep 19, 2004 at 03:26 UTC
    The only real solution to this problem is to see if you can use something as the type of ref you want:
    sub hashref { eval { \%{$_[0]} } } sub myfunc { hashref($_[0]) or die "myfunc expected a hashref"; }
    reftype won't handle all cases (e.g. deref-overloading or perl4-style glob passing).