in reply to LSOF Perl Implementation

I often find myself saying similar things in a quest to make my scripts as general and as portable as possible. If there were a Unix::lsof CPAN package available, I think you would be remiss in not using it. However, since there does not appear to be one, you have two options:

In a perfect world we'd always use a well-tested and highly portable CPAN module for things like this, and all of our Perl scripts would be portable to a wide variety of operating systems. However, it's important to sometimes forgo idealism in order to get the job done. Cheers. :)

Replies are listed 'Best First'.
Re^2: LSOF Perl Implementation
by hubb0r (Pilgrim) on Jun 06, 2005 at 20:50 UTC
    At the moment, the way I am doing it is with the pipe. The reason that I was looking for a more pure-perl implementation or a wrapped c-code implementation was that this is running in a script that sometimes runs MANY times (often simultaneously) (it's a ftp-server postprocessor). The need for the lsof call is that there is some apparent corruption happening on certain files (and they are all rijndael encrypted, hence 1 1 byte corruption is VERY bad!!) and it appears to me that the FTP server is holding open a file during a rename and I am processing the file prior to it flushing the buffer or something.

    Tha bug is very frustrating, and also quite difficult to track down. It's a complex system involving PocketPC devices, a linux server running proftpd, plus lots of backend post-processing of the files created by the pocketpc devices...

    Again, thanks for your input. If I find that the numerous piped lsof calls are putting to much of a strain on the server, I'll probably port it to a module (and CPAN it). Might be an interesting foray into the world of XS or inline c!