Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm fairly new to perl so I'm sorry for the ignorance. I have written a script using flock that appends to a file. I believe that flock is working correctly, but my question is when I try to open the file should I still use die? So in other words, if the file is currently locked and someone else is trying to open it will it die or wait. Here is my code
open (UNSUB, ">>unsubscribe.txt") or die send_email("Open Unsubscribe. +txt$!\nUnsubscribe $surveyID"); flock (UNSUB, 2) or die send_email("Flock Unsubscribe.txt$!\nUnsubscri +be $surveyID"); print UNSUB "$surveyID\n"; close UNSUB;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use die with flock
by Abigail-II (Bishop) on Jul 24, 2003 at 14:50 UTC | |
by Limbic~Region (Chancellor) on Jul 24, 2003 at 15:47 UTC | |
|
Re: use die with flock
by cfreak (Chaplain) on Jul 24, 2003 at 15:03 UTC | |
by Abigail-II (Bishop) on Jul 24, 2003 at 15:17 UTC | |
|
Re: use die with flock
by edan (Curate) on Jul 24, 2003 at 15:20 UTC | |
|
Re: use die with flock
by particle (Vicar) on Jul 24, 2003 at 15:11 UTC | |
by Abigail-II (Bishop) on Jul 24, 2003 at 15:21 UTC |