You can test if the handle is writable with -w HANDLE. That will return false if the handle has been closed.
I suspect, though, that the errors are coming from the mail application instead of a double close. Here's what happens with a double close:
The second close would not pick up mail system errors, since the mail system is already dissociated from the dead handle.$ perl -w -e'open MAIL, ">", "/dev/null"; close MAIL or warn 1, $!; cl +ose MAIL or warn 2, $!' 2Bad file descriptor at -e line 1. $
I think your problem is with the mail app, and you don't give much to go on for that. Lots of scripts people sell are not particularly well-written. Does yours use one of the standard CPAN Mail modules?
After Compline,
Zaxo
In reply to Re: checking a file handle to see if it is open
by Zaxo
in thread checking a file handle to see if it is open
by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |