When I run the following code:

perl -wle "use Fcntl;$n=O_CREAT | O_NONBLOCK | O_RDWR;print $n;"

I get

Your vendor has not defined Fcntl macro O_NONBLOCK, used at -e line 1.

... which is highly likely true, because nonblocking file IO does not exist on Windows, and thus a constant O_NONBLOCK does not exist on Windows. Using the numerical values that are defined on Linux will likely not work for other operating systems because the vendors may (or may not) have defined different values for the symbolic names.

I recommend that you evaluate your program whether O_NONBLOCK is actually needed. If that feature is acutally needed, you will need to investigate what to do on operating systems where O_NONBLOCK does not exist. If you don't need it, just remove it.

If this is to be used for sockets (and not generic files), you will need to look up the way to switch a socket to nonblocking IO on Windows. It is some IOCtl that is usually found via Google.


In reply to Re: How to get 'Fcntl' defines on Strawberry Perl? by Corion
in thread How to get 'Fcntl' defines on Strawberry Perl? by flexvault

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.