http://qs321.pair.com?node_id=506414

DrWhy has asked for the wisdom of the Perl Monks concerning the following question:

I've been looking all over for the answer to this question and it is either so simple that no one else bothers to ask it (and I'm an idiot) or it is very esoteric (and I'm a genius -- or would be if I knew the answer). I've got a module that carries it's own output handle around for doing output. It contains a function that lets the user pass in a new output handle. I want to check that you can actually write to this handle before accepting this as the module's new output channel. I can use fileno() to check if it's open or not, but I can't seem to find a way to tell if it's open for writing or not. The closest thing seems to be to use select() (or IO::Select) to see if it's ready for writing. I'm not sure, though if that is good enough; it seems to me like you could have a filehandle open for writing, but not ready at that moment to be written to.

Anybody got any better ideas how to do this?

--DrWhy

"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."