in reply to Close all open file descriptors

How about

use POSIX qw[ close ]; POSIX::close( $_ ) for 3 .. 1024; ## Arbitrary upper bound

This seems to work ok on win32 which isn't the most posix-complient beast in the world.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^2: Close all open file descriptors
by Fletch (Bishop) on Jul 28, 2004 at 15:34 UTC

    Then again you can use POSIX::sysconf( &POSIX::_POSIX_OPEN_MAX ) instead of an arbitrary bound. :)

    Update: Ooh, missed the Win32 there. Yeah, All hope abandon, ye who program here.

      I said that Win32 was the most posix compliant beast in the world :)

      print POSIX::sysconf( &POSIX::_POSIX_OPEN_MAX );; POSIX::sysconf not implemented on this architecture at ...

      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

        I said that Win32 was the most posix complient beast in the world :)

        Fortunately, that's not what you actually said :)

        --
        edan