Or if the disk is full; or if it's an IO::Socket::INET handle where the network connection has dropped; etc. Detecting anything that could possibly go wrong with a filehandle is not my aim. The primary use case for IO::Detect is, as stated in the documentation, writing functions that can accept either a file name or a file handle.
For example parse($file) - I want it to accept a filehandle, and I want it to accept a filename. If someone passes a filehandle in write-only mode then that's their own fault and I'm quite happy for it to blow up in their face.
As far as detecting whether a file handle is read or write, I may add that functionality if I come across a situation where it would be useful.
Re FileHandle::Fmode...
$ perl -MFileHandle::Fmode=is_FH -MIO::All -E'say is_FH(IO::All->new(" +/dev/null"))' 0
In reply to Re^4: Best way to check if something is a file handle?
by tobyink
in thread Best way to check if something is a file handle?
by tobyink
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |