Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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";
    close(MYFILE);
    
  2. or download this
    
    #!/usr/bin/perl
    ...
    print "You are now in my list, $newfriend!\n"
    exit;
    
  3. or download this
      open(MYFILE, ">$myfile") || die;
    
  4. or download this
      flock FILEHANDLE, OPERATION
    
  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
    
    #!/usr/bin/perl
    ...
    print "You are in my list, $newfriend!\n"
    exit;
    
  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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://7058]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-07-29 20:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (228 votes), past polls