Skip Menu |
 

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

Report information
The Basics
Id: 69657
Status: open
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: STEFFENW [...] cpan.org
Cc:
AdminCc:

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



Subject: option binmode does not handle the encoding like expected it ignores that
Download (untitled) / with headers
text/plain 274b
Hello, I have added a zip file. Inside is a file copy.pl that copies a file iso-8859-2.txt using open to utf-8.txt. And that copies the same file iso-8859-2.txt using File::Slurp to slurp_out.txt. The fist way is correct. File slurp does not change the encoding. --Steffen
Subject: test.zip
Download test.zip
application/zip 1.1k

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 538b
A very simple replacement for read_file $lines = read_file($filename, binmode => ':encoding(iso-8859-2)'); or @lines = read_file($filename, binmode => ':encoding(iso-8859-2)'); I use at the moment is sub read_file { my ( $filename, undef, $encoding ) = @_; open my $file_handle, "< $encoding", $filename or croak "Can not open file '$filename' $OS_ERROR"; my @content = <$file_handle>; () = close $file_handle; return wantarray ? @content : join q{}, @content; }


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.