in reply to Re: Bareword "SEEK_END" not allowed while "strict subs" in use (truncate)
in thread Bareword "SEEK_END" not allowed while "strict subs" in use

To: tye,

Ok, starting to make more sense.

My plan was to use flock() to lock the file while my process will be either reading or writting to it. I want to avoid 2 processes together reading and writting simultaneously which will result on overlaping.

So my plan was to lock the file seek to the end of the file so I can write the next part of my output, close the file and allow the next process to write on it.

I was under the impression that I have to use truncate to empty the rest of the file at the end, to make sure there is nothing left besfore start writting.

I got this idea from the tutorial File Locking where they use both:

seek(MYFILE, 0, 0); truncate(MYFILE, 0);

This is my part of confusion.

  • Comment on Re^2: Bareword "SEEK_END" not allowed while "strict subs" in use (truncate)
  • Download Code