G'day bernuli,

Welcome to the Monastery.

I haven't had a macOS system for some years, so I'm unable to test this for you; also, I don't recall ever using F_NOCACHE or seeing it documented.

The following is a possible workaround. This is on v5.36 but using Cygwin; I'm not expecting F_NOCACHE to be found. I ran some demo tests using this common alias of mine which reports many types of problems:

$ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E +'

O_RDONLY is exported by default but F_NOCACHE is not:

$ perle 'use Fcntl; say O_RDONLY' 0 $ perle 'use Fcntl; say O_RDONLY; say F_NOCACHE' Name "main::F_NOCACHE" used only once: possible typo at -e line 1. 0 say() on unopened filehandle F_NOCACHE at -e line 1.

F_NOCACHE cannot be explicitly imported:

$ perle 'use Fcntl qw{O_RDONLY F_NOCACHE}; say O_RDONLY; say F_NOCACHE +' "F_NOCACHE" is not exported by the Fcntl module Can't continue after import errors at -e line 1. main::BEGIN() called at -e line 1 eval {...} called at -e line 1 BEGIN failed--compilation aborted at -e line 1.

I can fake it like this (i.e. the "possible workaround"):

$ perle 'use Fcntl; use constant F_NOCACHE => 48; say O_RDONLY; say F_ +NOCACHE' 0 48 $ perle 'use Fcntl; use constant F_NOCACHE => 48; say O_RDONLY | F_NOC +ACHE' 48 $ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; say O_RDONLY; say F_NOC +ACHE' 0 48 $ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; say O_RDONLY | F_NOCACH +E' 48

I've no idea idea if sysopen will accept that on your system. Curiously, it doesn't complain on mine:

$ perle 'use Fcntl; use enum qw{F_NOCACHE=48}; sysopen my $fh, "dummy_ +file", O_RDONLY | F_NOCACHE; close $fh'

I don't know if there's a way to build Perl such that F_NOCACHE is recognised but someone else might. To help with that, tell us how you built the current Perl you're using. It may also be helpful to show the output of `perl -V` (that's a capital V).

— Ken


In reply to Re: macOS Fcntl.pm missing F_NOCACHE by kcott
in thread macOS Fcntl.pm missing F_NOCACHE by bernuli

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.