Skip Menu |

This queue is for tickets about the File-Slurp CPAN distribution.

Report information
The Basics
Id: 84918
Status: new
Priority: 0/
Queue: File-Slurp

Owner: Nobody in particular
Requestors: corion [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: read_file() ignores binmode option for short files
Date: Mon, 29 Apr 2013 21:50:18 +0200
To: bug-File-Slurp [...]
From: Max Maischein <corion [...]>
Download (untitled) / with headers
text/plain 762b
Hello, thanks for writing File::Slurp. I noticed a bug in File::Slurp which leads to bad data being read. The binmode option is ignored in the code path for short files. Especially when reading and writing text files on Windows using {binmode => ':raw'}, but also when processing UTF-8 files, this is quite bad. The quick workaround is to simply delete that wrong optimization at the start of read_file(). If you want to keep the code path for short files, you will have to come up with your own way of reimplementing IO layers, or at least detect :raw and likely :utf-8 layers and act on them appropriately. Especially the line to "fix" Windows input does not seem prudent: $buf =~ s/\015\012/\n/g if $is_win32 ; Thanks for looking at this, -max

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to