in reply to Re: Re: fcntl on Windows
in thread fcntl on Windows

You forgot the line:
use Fcntl;
Easy mistake to make. That should fix it.

Update:
I tried your code (plus the use statement and a few print statements) on my NT box with Perl 5.6 and got this rather annoying message:

Your vendor has not defined Fcntl macro F_GETFL, used at C:\temp.pl li +ne 10.
That means the Fcntl implementation in my install is incomplete. I suspect this is going to be true across Windows installations, so you might want to write a wrapper around Fcntl that defaults to Fcntl but fills in the holes when they are missing.

Replies are listed 'Best First'.
Re: Re: Re: Re: fcntl on Windows
by Daimun (Novice) on Mar 21, 2001 at 01:11 UTC
    I apologize for the back-and-forth, but.. with that fix (Which I had already tried..) - I get:

    Your vendor has not defined Fcntl macro F_GETFL, used at ...

    If I then change F_GETFL to something random like F_GETFALLY or the such, I again get:

    fcntl is not implemented ...

    But.. again, it all works perfectly on the unix side. Frustrating me, indeed.

    Daimun
Re: Re: Re: Re: fcntl on Windows
by Daimun (Novice) on Mar 21, 2001 at 01:16 UTC
    Trying to tap the well of knowledge here..
    What other ways are there to do what fcntl does? I'm not clear on what my other options might be.

    Daimun
      Ooops. We are chasing a red herring. As "Programming Perl 2ed"(166) explains:
      fcntl will produce a fatal error if used on a machine that doesn't implement fcntl(2). On machines that do implement it, you can do such things as modify the close-on-exec flags, modify the non-blocking I/O flags, emulate the lockf(3) function...
      In otherwords, you are SOL on Windows machines. Your best alternative is to loop on select with a very small timeout. The use of polling to achieve non-blocking is not-uncommon, but it is probably slower and more processor intensive (I don't really know.) So then you will want to implement this twice, once for when $^O eq 'MSWin32' and once for when it doesn't.