Thursday, December 4, 2014

flock - All u need to know abut file locking in perl

Some times we need control over  read and write over files operation. File locking comes for rescue.

Though Perl provide many function to control over  file locking operation. I found flock function is the best.

Perl monks has a great tutorial for flock and operation and usage . Simple usage  and operation number and their meaning.

  sub LOCK_SH { 1 } ## shared lock
  sub LOCK_EX { 2 } ## exclusive lock
  sub LOCK_NB { 4 } ## non-blocking
  sub LOCK_UN { 8 } ## unlock 

No comments:

Post a Comment