in reply to Re: How do I tell if a handle is open for writing?
in thread How do I tell if a handle is open for writing?

I'm trying to extend this to a comparable readable() function.
sub readable { my $fh = shift; (O_RDONLY | O_RDWR) & fcntl( $fh, F_GETFL, my $slush); } for (qw/ > < >> +< +> /) { open my $fh, $_, 'foo' or warn $! and next; print "$_\t", readable($fh)? 'readable.': 'not readable.', $/; } __END__ > not readable. < not readable. >> not readable. +< readable. +> readable.
Huh??!

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?