Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: Being more Assert-ive with Perl

by antirice (Priest)
on Sep 18, 2004 at 02:10 UTC ( #391931=note: print w/ replies, xml ) Need Help??


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


Comment on Re^2: Being more Assert-ive with Perl
Select or Download Code
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).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391931]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2015-07-30 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls