Skip Menu |

This queue is for tickets about the IO-stringy CPAN distribution.

Report information
The Basics
Id: 72710
Status: open
Priority: 0/
Queue: IO-stringy

People
Owner: dfs+pause [...] roaringpenguin.com
Requestors: gavin [...] openfusion.com.au
Cc:
AdminCc:

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



Subject: IO::InnerFile slurp mode is non-optimal
Slurp mode on IO::InnerFile filehandles works non-optimally: it slurps the entire underlying file and then truncates the output. So on a 4G file with a 100B inner file the whole 4G file gets slurped each time. Example demonstrating the problem is attached (based on report from Miles Crawford: http://groups.google.com/group/brackup/browse_thread/thread/1047aec5cc261a3e). Suggested patch attached. Cheers, Gavin
Subject: test
Download test
application/octet-stream 375b

Message body not shown because it is not plain text.

Subject: io-innerfile-slurp.diff
--- /usr/share/perl5/IO/InnerFile.pm.dist 2011-11-25 15:08:04.048188626 +1100 +++ /usr/share/perl5/IO/InnerFile.pm 2011-11-25 15:56:18.947465726 +1100 @@ -230,6 +230,12 @@ my ($self) = @_; return undef if ($self->{CRPOS} >= $self->{LG}); + # Handle slurp mode + if (! defined $/) { + $self->READ(my $text, $self->{LG} - $self->{CRPOS}); + return $text; + } + ### Save and seek... my $old_pos = $self->{FH}->tell; $self->{FH}->seek($self->{CRPOS}+$self->{START}, 0);
Subject: Re: [rt.cpan.org #72710] IO::InnerFile slurp mode is non-optimal
Date: Fri, 25 Nov 2011 11:27:11 -0500
To: bug-IO-stringy [...] rt.cpan.org
From: "David F. Skoll" <dfs [...] roaringpenguin.com>
Hi, Gavin, Show quoted text
> Suggested patch attached.
Thanks for that. I've applied the patch to my development version and added a test to verify that slurp-mode returns expected contents. Regards, David.
Subject: Re: [rt.cpan.org #72710] IO::InnerFile slurp mode is non-optimal
Date: Sat, 26 Nov 2011 14:42:51 +1100
To: "David F. Skoll via RT" <bug-IO-stringy [...] rt.cpan.org>
From: Gavin Carr <gavin [...] openfusion.com.au>
On Fri, Nov 25, 2011 at 11:27:22AM -0500, David F. Skoll via RT wrote: Show quoted text
><URL: https://rt.cpan.org/Ticket/Display.html?id=72710 > > >Hi, Gavin, >
>> Suggested patch attached.
> >Thanks for that. I've applied the patch to my development version >and added a test to verify that slurp-mode returns expected contents.
Excellent. Thanks David. Cheers, Gavin