D
Dave Saville
I was debugging a totally unrelated problem yesterday and put in a
quick and dirty print line with $! in it. Now as it happened the bit of
code I was trying to debug was not giving the error I thought it was
and so $! of course had a previous value.
What printed out was "Illegal Seek" - looking backwards I found a "seek
HANDLE,0,0; Now I have never seen any code where the return from seek
is checked although I guess it should be
The actual code is as follows:
open LIST, "<$clean_username" or die "$clean_username $!";
flock LIST, $LOCK_EX;
seek LIST, 0, 0;
I had read that one should re seek after flock in case another process
modified the file between you opening it and flock coming back with the
exclusive lock.
Or does seek give an error if it is already where one wants to seek to?
TIA
Regards
Dave Saville
NB switch saville for nospam in address
quick and dirty print line with $! in it. Now as it happened the bit of
code I was trying to debug was not giving the error I thought it was
and so $! of course had a previous value.
What printed out was "Illegal Seek" - looking backwards I found a "seek
HANDLE,0,0; Now I have never seen any code where the return from seek
is checked although I guess it should be
The actual code is as follows:
open LIST, "<$clean_username" or die "$clean_username $!";
flock LIST, $LOCK_EX;
seek LIST, 0, 0;
I had read that one should re seek after flock in case another process
modified the file between you opening it and flock coming back with the
exclusive lock.
Or does seek give an error if it is already where one wants to seek to?
TIA
Regards
Dave Saville
NB switch saville for nospam in address