in reply to File::Tail behaves funny

I think you are not including a final newline. Many Win32 editors don't expect/require a final newline and even display a file containing a single final newline as if it ended with a blank line.

The Mad Hatter mentions this possibility but I think more stress on this possibility was warranted.

File::Tail will not give you a line until it sees the end of that line. When it sees a line with no final newline at the end of the file, it assumes that it managed to catch the line in the middle of being written and it waits for the rest of the line to show up. In practice, this is usually the case.

Most things that write lines include the newline, because it takes too much effort to figure out whether you are writing the last line or not [Also because Unix and at least some other non-Win32 operating systems don't always take kindly to the newline being left of the last line in the file (Win32 seems to go out of its way to make this okay, such as including a blank line before the command prompt -- type "echo hi" as a quick way to see this)].

                - tye
  • Comment on Re: File::Tail behaves funny (final newline)

Replies are listed 'Best First'.
Re: Re: File::Tail behaves funny (final newline)
by abhishes (Friar) on Apr 08, 2003 at 10:07 UTC

    You are absolutely right!. The strange behavior is occuring because when I add a line "a b c" i don't press enter after it.

    If I do, then the utiltity works the way I want to (except that I have to wait for 10 seconds to see the changes... I would like to reduce this to one second).

    Also, Does the unix tail -f utiltity also depend on the carriage return at the end of the line?

    regards,
    Abhishek.