"be consistent" | |
PerlMonks |
Re: flock questionby Odud (Pilgrim) |
on Jun 27, 2000 at 14:32 UTC ( [id://19978]=note: print w/replies, xml ) | Need Help?? |
Another one where I post a partial answer to my own question. The problem seems to be that I have made an assumption about how filehandles behave. The code for Copy will open and close the file if given a filename but not if given a filehandle. This makes sense. What surprised me was that closing the file would release the lock. I was thinking that if I had obtained the lock by using filehandle XX then I would have to close it through XX to release the lock. I didn't do an explicit close and was expecting the lock to exist until the end of the script In summary the sequence of events is: opened as XX # by me locked as XX # by me opened as YY # by copy closed as YY # by copy and the lock is released Copy says "Note that passing in files as handles instead of names may lead to loss of information on some operating systems; it is recommended that you use file names whenever possible." - which is how I got into this mess in the first place
In Section
Seekers of Perl Wisdom
|
|