in reply to Testing for a directory handle
You could write a little XS module to look into the xpvio structure. I think the dirp slot is the one telling you it is an open directory handle.