use Test::More tests => 4; use IO::Handle; use strict; use warnings; sub ishandle { my $h = shift; return $h if eval { $h->isa('IO::Handle') }; return *$h{IO} if ref $h eq 'GLOB' or ref \$h eq 'GLOB'; return $h; } isa_ok( ishandle( new IO::Handle ), 'IO::Handle' ); isa_ok( ishandle( *STDIN ), 'IO::Handle' ); isa_ok( ishandle( \*STDIN ), 'IO::Handle' ); isa_ok( ishandle( *STDIN{IO} ), 'IO::Handle' ); __END__ 1..4 ok 1 - The object isa IO::Handle ok 2 - The object isa IO::Handle ok 3 - The object isa IO::Handle ok 4 - The object isa IO::Handle #### no strict 'refs' return *$h{IO} if eval { *$h{IO} };