Perl-Sensitive Sunglasses | |
PerlMonks |
Re: readdir() on a sysopen() handle?by afoken (Chancellor) |
on Aug 20, 2017 at 13:05 UTC ( [id://1197699]=note: print w/replies, xml ) | Need Help?? |
Looking through several linux man pages, it looks like you normally should use opendir, readdir or scandir, and closedir from C. Those functions are specified by POSIX and are portable. But the glibc also offers fdopendir that converts a plain integer file descriptor to a DIR *. So in C, something like this should work:
Converting that to a perl directory handle will very likely require a little bit of XS code. Perhaps Inline::C might be helpful. You definitively want to have a look at the perl sources, the part that implements the opendir function, to see how to correctly create a directory handle. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|