"Get a REAL OS," so goes the chant of the rabble.

Problem is this. If you've got multiple processes with a file open for writing and reading at the same time, trouble results. So you need locking. The flock() call is one method of locking a resource in Perl.

In Win98/95, only one user is expected to be using the system at a time. Thus, file locking (at least on this level) shouldn't really be a concern, right?. The OS won't allow more than one process in Win98/95 to have a file open for writing at the same time. That solves the locking problem and makes flock() unnecessary for the OS... The problem is that Perl wants to use this locking mechanism, but it simply doesn't exist in Win98/95.

So what do you do? Well, if this were a long-term thing I'd agree with the rabble. If you're just working out the bugs, noodling around with the system before it goes into production, try this:

# Change this flock(FH, LOCK_EX) || die "Error in flock: $!"; # Into this (untested, no Win98 machine handy) eval { flock(FH, LOCK_EX) || die "Error in flock: $!"; }; die unless ($@ =~ /unimplemented/);
This will essentially ignore the flock()'s on Win95/98, but they really shouldn't be a concern of yours anyway if you're just testing, right?

In reply to Re: flock error...? by clintp
in thread flock error...? by FireBird34

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.