Package: libfile-slurp-perl Version: 9999.09-1 Severity: important Tags: patch
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 to the Debian package. Regards, Allard Hoeve PS: I will file the bug with the upstream author as well, but cpan.org is unreachable to me for example. -- System Information: Debian Release: 4.0 Architecture: i386 (i686) Kernel: Linux 2.6.20.4-fwsh-byte Locale: LANG=en_US.UTF8, LC_CTYPE=en_US.UTF8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF8) Versions of packages libfile-slurp-perl depends on: ii perl 5.8.8-7 Larry Wall's Practical Extraction -- no debconf information
--- /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