in reply to if (ref $value eq "ARRAY") {
also, has it been blessed? might be of some interest to you.
i don't think it's too much to test two cases if( ref $t_ref and ! UNIVERSAL::can($t_ref, 'isa') ), given the benefits.#!/usr/bin/perl use strict; use warnings; $|++; package tiedarray; use Tie::Array; our @ISA=('Tie::StdArray'); package main; for my $t_ref ( [], bless([]), tie(@{[]}, 'tiedarray') ) { if( ref $t_ref ) { print q{i'm a ref}, $/; if( UNIVERSAL::can( $t_ref, 'isa' ) ) { print q{i'm an object, too}, $/; } } print $/; } __END__ # prints: i'm a ref i'm a ref i'm an object, too i'm a ref i'm an object, too
~Particle *accelerates*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: if (ref $value eq "ARRAY") {
by John M. Dlugosz (Monsignor) on Aug 26, 2002 at 15:30 UTC |