in reply to Is "ref $date eq 'ARRAY'" wrong?
In the years since I've written this, UNIVERSAL::isa has been written. Use that instead.
No, you'd have to say it as isa( $date, 'ARRAY' ). The documentation for UNIVERSAL says to import isa() before using it so here's the proper way. By using isa() you've just allowed your users to bless their arrays before giving them to you. When you check ref() you impose a no-blessings and no-subclassing requirement which really isn't all that friendly or perlish.
*isa = \&UNIVERSAL::isa; sub foo { my $date = shift; return unless isa( $date, 'ARRAY' ); bar( $date ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is "ref $date eq 'ARRAY'" wrong?
by Abigail-II (Bishop) on Dec 19, 2003 at 16:36 UTC | |
by diotalevi (Canon) on Dec 19, 2003 at 18:26 UTC | |
|
Re: Re: Is "ref $date eq 'ARRAY'" wrong?
by sauoq (Abbot) on Dec 20, 2003 at 04:20 UTC | |
by diotalevi (Canon) on Dec 21, 2003 at 04:10 UTC | |
by sauoq (Abbot) on Dec 21, 2003 at 08:02 UTC | |
|
Re: Re: Is "ref $date eq 'ARRAY'" wrong?
by jmanning2k (Pilgrim) on Dec 22, 2003 at 14:55 UTC |