Jun 17, 2000, 5:15 PM
Post #5 of 5
First, I've been avoiding using any modules. First, my main reference doesn't give me info on them. Second, I want to learn as much as possible, which means doing things myself rather than relying on modules. I'll use them if I have to, but so far I haven't used any.
Re: File locking and preserving data.
[In reply to]
From what my reference says, if a system doesn't use flock(), Perl 5.001m and later will emulate it using fcntl(), so I think flock is the best way to go.
Do I need the module to use flock? Or does it just define the $LOCK_SH, _EX, _NB and _UB variables?
If I need it to flock, I'll use it. If it's just for the variables, I can use numeric values and comments.
BTW, in the following:
open(FH, "database.txt") or die $!;
$cure = <FH>;
Did you actually mean _NB? I'm assuming you wanted _UN.
BTW, I just read the following:
"OPERATION is one of LOCK_SH, LOCK_EX, or LOCK_UN, possibly combined with LOCK_NB."
I'm assuming that you would only combine _NB with one of the first two. Combining it with LOCK_UN wouldn't make sense to me.