in reply to File::Slurp bug? Should I bother?


Does binmodeing the filehandle fix the problem?

... my $file_slurp = read_file('file', binmode => ':raw'); ...

--
John.

Replies are listed 'Best First'.
Re^2: File::Slurp bug? Should I bother?
by ikegami (Patriarch) on Sep 07, 2005 at 17:14 UTC
    Isn't that backwards? I believe he wants to remove the "added" Carriage Returns, not preserve them.

      Yes, it is more than a little backwards. Binmodeing the $FILE filehandle gives the same results in both cases.
      ... binmode $FILE; ... __END__ Prints: "Line\r\nLine2\r\nLine3\r\n" "Line\r\nLine2\r\nLine3\r\n" Yep.

      In which case you would also have to binmode the output filehandles in order not to add extra carriage returns!!

      HOWEVER, it doesn't seem right that the carriage returns are in the File::Slurp data without binmode being set. Is this a function of using sysread?

      Can't check at the moment I'll look at it again later.

      --
      John.