Dear Maintainer,
File::Slurp does not support reading from or writing to files
that use multibyte character sets. The manual even says so :)
Even still, the patch to support this is stunningly simple.
Please apply the patch.
Regards,
Allard Hoeve
PS: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=429933
Subject: | libfile-slurp-perl_binmode.patch |
--- /usr/share/perl5/File/Slurp.pm.orig 2005-04-19 07:12:40.000000000 +0200
+++ /usr/share/perl5/File/Slurp.pm 2007-06-21 12:37:36.000000000 +0200
@@ -65,7 +65,6 @@
# a regular file. set the sysopen mode
my $mode = O_RDONLY ;
- $mode |= O_BINARY if $args{'binmode'} ;
# open the file and handle any error
@@ -75,6 +74,8 @@
goto &error ;
}
+ binmode($read_fh, $args{'binmode'}) if $args{'binmode'};
+
# get the size of the file for use in the read loop
$size_left = -s $read_fh ;
@@ -210,7 +211,6 @@
# set the mode for the sysopen
my $mode = O_WRONLY | O_CREAT ;
- $mode |= O_BINARY if $args->{'binmode'} ;
$mode |= O_APPEND if $args->{'append'} ;
$mode |= O_EXCL if $args->{'no_clobber'} ;
@@ -221,6 +221,8 @@
@_ = ( $args, "write_file '$file_name' - sysopen: $!");
goto &error ;
}
+
+ binmode($write_fh, $args->{'binmode'}) if $args->{'binmode'};
}
sysseek( $write_fh, 0, SEEK_END ) if $args->{'append'} ;
@@ -435,10 +437,8 @@
mode.
my $bin_data = read_file( $bin_file, binmode => ':raw' ) ;
-
-NOTE: this actually sets the O_BINARY mode flag for sysopen. It
-probably should call binmode and pass its argument to support other
-file modes.
+ # Or
+ my $bin_data = read_file( $bin_file, binmode => ':utf8' ) ;
=head3 array_ref
@@ -537,10 +537,8 @@
mode.
write_file( $bin_file, {binmode => ':raw'}, @data ) ;
-
-NOTE: this actually sets the O_BINARY mode flag for sysopen. It
-probably should call binmode and pass its argument to support other
-file modes.
+ # Or
+ write_file( $bin_file, {binmode => ':utf8'}, @data ) ;
=head3 buf_ref