Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
"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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-26 01:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found