Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

File Locking

by turnstep (Parson)
on Apr 06, 2000 at 22:33 UTC ( #7058=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    open(MYFILE, ">>$myfile") || die;
    flock(MYFILE, 2) || die;
    print MYFILE "Cottleston Pie\n";
  2. or download this
    print "You are now in my list, $newfriend!\n"
  3. or download this
      open(MYFILE, ">$myfile") || die;
  4. or download this
  5. or download this
      sub LOCK_SH { 1 } ## shared lock
      sub LOCK_EX { 2 } ## exclusive lock
      sub LOCK_NB { 4 } ## non-blocking
      sub LOCK_UN { 8 } ## unlock
  6. or download this
    print "You are in my list, $newfriend!\n"
  7. or download this
      flock(MYFILE, 1);
  8. or download this
      flock(MYFILE, 2);
  9. or download this
      open(MYFILE, "+< $myfile") || die;
  10. or download this
      seek(MYFILE, 0, 0); truncate(MYFILE, 0);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://7058]
Veltro is a weirdo, obsessed with whitespace
[marto]: to use the word "obsession" when so few people have said so little about it is grasping at staws
marto wishes tye was around, he's so much better at this sort of thing
usemodperl likes tye!
usemodperl tye  too
[choroba]: Re^3: LiBXML: New markup while preserving earlier tags? would benefit from a couple of test cases
usemodperl meant tye&nbsp;
usemodperl pokes Veltro with line noise
usemodperl will try to make better shapes with his line noise, like a camel, or boobs, then it will be called "clever" :-)
Veltro Veltro translates line noise. It spells JAPH,

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2018-06-24 16:05 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.