Skip Menu |

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

Report information
The Basics
Id: 28491
Status: resolved
Priority: 0/
Queue: File-Slurp

People
Owner: Nobody in particular
Requestors: allard [...] byte.nl
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.01
  • 2001.1103
  • 2002.0305
  • 2002.1031
  • 2004.0904
  • 96.042202
  • 98.071901
  • 9999.01
  • 9999.02
  • 9999.03
  • 9999.04
  • 9999.06
  • 9999.07
  • 9999.08
  • 9999.09
  • 9999.10
  • 9999.11
  • 9999.12
Fixed in: (no value)



Subject: Please patch File::Slurp to support multi-byte character files (patch included)
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
Hi allard, Are you up for adding some tests for this, too? Surely it'll be easier to get Dave (the new maintainer) to apply the patch, then.
CC: allard [...] byte.nl
Subject: Re: [rt.cpan.org #28491] Please patch File::Slurp to support multi-byte character files (patch included)
Date: Sat, 16 Oct 2010 21:12:28 +0200
To: bug-File-Slurp [...] rt.cpan.org
From: Allard Hoeve <allard [...] byte.nl>
Yes, I am. But am also short on time. More to follow... Met vriendelijke groet, Allard Sent from my HTC. On Oct 14, 2010 3:04 AM, "ABH via RT" <bug-File-Slurp@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=28491 > > > Hi allard, > > Are you up for adding some tests for this, too? Surely it'll be easier to
get Dave (the new Show quoted text
> maintainer) to apply the patch, then.
Subject: Re: [rt.cpan.org #28491] Please patch File::Slurp to support multi-byte character files (patch included)
Date: Mon, 18 Oct 2010 11:46:18 +0200
To: bug-File-Slurp [...] rt.cpan.org
From: Allard Hoeve <allard [...] byte.nl>
Hello all, I found some time to write tests. Please find the patch attached. Best, Allard

Message body is not shown because sender requested not to inline it.

fixed