in reply to Re^3: Best way to check if something is a file handle?
in thread Best way to check if something is a file handle?
The strange thing is that although $fh->can('close') doesn't return true, it also doesn't complain about there being no can method, whereas $fh->might('close') does complain about a missing might method. So it is, in some manner being treated as an object that kinda half implements the UNIVERSAL interface.
Writing the empty string to a handle is quite a nice solution I suppose, but there may be some tied interfaces where printing even the empty string has side-effects. :-(
And as it happens I'm actually more interested in reading than writing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Best way to check if something is a file handle?
by davido (Cardinal) on Jul 09, 2012 at 15:41 UTC | |
by tobyink (Canon) on Jul 09, 2012 at 16:25 UTC |