in reply to Re: Best way to check if something is a file handle?
in thread Best way to check if something is a file handle?
Practical experimentation shows this doesn't work. :-(
use 5.010; use Test::More; use IO::Handle; open my $fh, ">", "/tmp/foo" or die "argh"; ok $fh->can("close"); ok UNIVERSAL::can($fh, "close"); done_testing(); __END__ not ok 1 # Failed test at fh.pl line 7. not ok 2 # Failed test at fh.pl line 8. 1..2 # Looks like you failed 2 tests of 2.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best way to check if something is a file handle?
by Athanasius (Cardinal) on Jul 09, 2012 at 10:18 UTC | |
by tobyink (Canon) on Jul 09, 2012 at 10:42 UTC | |
by davido (Cardinal) on Jul 09, 2012 at 15:41 UTC | |
by tobyink (Canon) on Jul 09, 2012 at 16:25 UTC |