Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Class CPAN distribution.

Maintainer(s)' notes

I prefer that bugs & patches are filed on GitHub rather than on RT: https://github.com/kenahoo/Path-Class/issues. Thanks.

Report information
The Basics
Id: 58088
Status: open
Priority: 0/
Queue: Path-Class

People
Owner: Nobody in particular
Requestors: gbarr [...] pobox.com
Cc:
AdminCc:

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



Subject: [PATCH] add iolayers option to slurp
Date: Thu, 3 Jun 2010 07:18:47 -0500
To: bug-Path-Class [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
The attached patch adds an iolayers option to ->slurp. This allows control over opening the file to allow crlf translation or file encodeing etc. Graham.

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

Good idea. Two things that need tweaking are: 1) it still needs to croak() if the open() doesn't succeed, and 2) the "<" mode can get tangled up with the iolayers, so if people pass a layer of e.g. "&=3" or something, it won't act like an iolayer. That might be useful too, but probably shouldn't be part of the 'iolayers' parameter. Any way to isolate the '<'? -Ken
Subject: Re: [rt.cpan.org #58088] [PATCH] add iolayers option to slurp
Date: Thu, 3 Jun 2010 09:20:17 -0500
To: bug-Path-Class [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Jun 3, 2010, at 7:33 AM, Ken Williams via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=58088 > > > Good idea. Two things that need tweaking are: 1) it still needs to croak() if the open() doesn't > succeed, and
thats a separate issue. seems a bit of an API change though as currently if it fails you get a warning and slurp returns nothing. could catch out a few people with unexpected failures Show quoted text
> 2) the "<" mode can get tangled up with the iolayers, so if people pass a layer of > e.g. "&=3" or something, it won't act like an iolayer. That might be useful too, but probably
Show quoted text
> shouldn't be part of the 'iolayers' parameter. Any way to isolate the '<'?
my thought was to ensure the open was a read. See IO::File->open documentation and 3-arg open in perlfunc Change the arg to be called iomode if you like and drop the adding of '<'. open will default to read anyway. They can then pass anything that is a valid open mode and if they do something funky like file($foobar)->slurp(iomode => '<&=3'); then they get what they get, as long as the open succeeds Just default iomode to 'r', ie my $fh = $self->open($args{iomode} || 'r'); Graham.
On Thu Jun 03 10:20:34 2010, gbarr@pobox.com wrote: Show quoted text
> On Jun 3, 2010, at 7:33 AM, Ken Williams via RT wrote:
> > > > 1) it still needs to croak() if the open() doesn't succeed, and
> > thats a separate issue. seems a bit of an API change though as > currently if it fails you get a warning > and slurp returns nothing. could catch out a few people with > unexpected failures
No, it calls openr(), which will die() (or in the next release, croak()) if it fails. Show quoted text
> Change the arg to be called iomode if you like and drop the adding of > '<'.
Good idea, that seems like a nice way to do it. Want to take a look at the latest copy (& docs) in SVN and see how you like it? -Ken
Subject: Re: [rt.cpan.org #58088] [PATCH] add iolayers option to slurp
Date: Thu, 3 Jun 2010 11:56:47 -0500
To: bug-Path-Class [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Jun 3, 2010, at 11:25 AM, Ken Williams via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=58088 > > > On Thu Jun 03 10:20:34 2010, gbarr@pobox.com wrote:
>> On Jun 3, 2010, at 7:33 AM, Ken Williams via RT wrote:
>>> >>> 1) it still needs to croak() if the open() doesn't succeed, and
>> >> thats a separate issue. seems a bit of an API change though as >> currently if it fails you get a warning >> and slurp returns nothing. could catch out a few people with >> unexpected failures
> > No, it calls openr(), which will die() (or in the next release, croak()) > if it fails.
Oops, my bad. Show quoted text
> Change the arg to be called iomode if you like and drop the adding of
>> '<'.
> > Good idea, that seems like a nice way to do it. Want to take a look at > the latest copy (& docs) in SVN and see how you like it?
looks good. need to update 03-filesystem.t also Graham.
Subject: Re: [rt.cpan.org #58088] [PATCH] add iolayers option to slurp
Date: Thu, 3 Jun 2010 11:59:37 -0500
To: bug-Path-Class [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
Here is the changes to the test. it seems the < is needed as just ":raw" is not a valid mode

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

Thanks, applied. -Ken