How do I lock a file in Perl?

前端 未结 14 605
礼貌的吻别
礼貌的吻别 2020-12-01 05:45

What is the best way to create a lock on a file in Perl?

Is it best to flock on the file or to create a lock file to place a lock on and check for a lock on the lock

14条回答
  •  鱼传尺愫
    2020-12-01 06:16

    flock creates Unix-style file locks, and is available on most OS's Perl runs on. However flock's locks are advisory only.

    edit: emphasized that flock is portable

提交回复
热议问题