Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: sharyanto [...] cpan.org
Cc:
AdminCc:

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



Subject: an autochomp reading mode?
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 349
Download (untitled) / with headers
text/plain 349b
I read one-line files a lot. They usually contain a single variable/ parameter, and usually produced from the command-line, e.g. 'echo foo@bar Show quoted text
> email'. As such, they contain newline which I almost always have to
chomp. Adding something like 'autochomp' option would certainly convenient: read_file('foo.txt', autochomp => 1). Regards, Steven
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-2362-1290147319-1674.63136-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 468
Download (untitled) / with headers
text/plain 468b
On Fri Nov 19 01:14:47 2010, SHARYANTO wrote: Show quoted text
> I read one-line files a lot. They usually contain a single variable/ > parameter, and usually produced from the command-line, e.g. 'echo
foo@bar Show quoted text
> > email'. As such, they contain newline which I almost always have to
> chomp. > > Adding something like 'autochomp' option would certainly convenient: > > read_file('foo.txt', autochomp => 1). > > Regards, > Steven
Or chomp => 1, for that matter. Regards, Steven
From uri [...] sysarch.com Fri Nov 19 01: 22:49 2010
CC: undisclosed-recipients: ;
MIME-Version: 1.0
X-Spam-Status: No, score=-6.751 tagged_above=-99.9 required=10 tests=[AWL=0.149, BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-2359-1290147287-1071.63136-4-0 [...] rt.cpan.org> (steven haryanto via RT's message of "Fri\, 19 Nov 2010 01\:14\:47 -0500")
X-Spam-Flag: NO
References: <RT-Ticket-63136 [...] rt.cpan.org> <rt-3.8.HEAD-2359-1290147287-1071.63136-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <87lj4pessy.fsf [...] quad.sysarch.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.751
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 08924241146 for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Fri, 19 Nov 2010 01:22:49 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yIbUHCEQMyOd for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Fri, 19 Nov 2010 01:22:43 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 48A9A24110A for <bug-File-Slurp [...] rt.cpan.org>; Fri, 19 Nov 2010 01:22:43 -0500 (EST)
Received: (qmail 10936 invoked by uid 103); 19 Nov 2010 06:22:42 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 19 Nov 2010 06:22:42 -0000
Received: from vms173003pub.verizon.net (HELO vms173003pub.verizon.net) (206.46.173.3) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 18 Nov 2010 22:22:40 -0800
Received: from sysarch.com ([unknown] [96.237.162.42]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LC400CEKCDPRKM6 [...] vms173003.mailsrvcs.net> for bug-File-Slurp [...] rt.cpan.org; Fri, 19 Nov 2010 00:22:38 -0600 (CST)
Received: (qmail 876 invoked by uid 1000); Fri, 19 Nov 2010 06:22:37 +0000
Delivered-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #63136] an autochomp reading mode?
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
Return-Path: <uri [...] sysarch.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
X-RT-Mail-Extension: file-slurp
Date: Fri, 19 Nov 2010 01:22:37 -0500
X-Spam-Level:
To: bug-File-Slurp [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
RT-Message-ID: <rt-3.8.HEAD-2360-1290147769-1524.63136-0-0 [...] rt.cpan.org>
Content-Length: 1438
Download (untitled) / with headers
text/plain 1.4k
Show quoted text
>>>>> "shvR" == steven haryanto via RT <bug-File-Slurp@rt.cpan.org> writes:
Show quoted text
shvR> Fri Nov 19 01:14:47 2010: Request 63136 was acted upon. shvR> Transaction: Ticket created by SHARYANTO shvR> Queue: File-Slurp shvR> Subject: an autochomp reading mode? shvR> Broken in: 9999.13 shvR> Severity: Wishlist shvR> Owner: Nobody shvR> Requestors: sharyanto@cpan.org shvR> Status: new shvR> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=63136 >
Show quoted text
shvR> I read one-line files a lot. They usually contain a single variable/ shvR> parameter, and usually produced from the command-line, e.g. 'echo foo@bar
Show quoted text
>> email'. As such, they contain newline which I almost always have to
Show quoted text
shvR> chomp.
Show quoted text
shvR> Adding something like 'autochomp' option would certainly convenient:
Show quoted text
shvR> read_file('foo.txt', autochomp => 1).
that is in my todo queue. a new release is due soon with a lot of fixes and interesting improvements. that one will go into the next release. the problem with your idea is how do you autochomp multiple lines when slurping to a scalar? so that option will only work if you slurp to an array or array ref. thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-2360-1290147769-1524.63136-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
References: <RT-Ticket-63136 [...] rt.cpan.org> <rt-3.8.HEAD-2359-1290147287-1071.63136-4-0 [...] rt.cpan.org> <87lj4pessy.fsf [...] quad.sysarch.com> <rt-3.8.HEAD-2360-1290147769-1524.63136-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-2357-1290150463-818.63136-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 814
Download (untitled) / with headers
text/plain 814b
On Fri Nov 19 01:22:49 2010, uri@stemsystems.com wrote: Show quoted text
> shvR> Adding something like 'autochomp' option would certainly
> convenient: >
> shvR> read_file('foo.txt', autochomp => 1).
> > that is in my todo queue. a new release is due soon with a lot of > fixes > and interesting improvements. that one will go into the next release.
Nice to know that a new release is imminent! Show quoted text
> the problem with your idea is how do you autochomp multiple lines when > slurping to a scalar? so that option will only work if you slurp to an > array or array ref.
You don't. In a scalar context, we can just chomp the whole file once. That makes perfect sense for one-line files in my case, and doesn't make much sense in a multiple-line files anyway. Of course we can chomp each line in array context. Regards, Steven
From uri [...] sysarch.com Fri Nov 19 02: 30:32 2010
CC: undisclosed-recipients: ;
MIME-Version: 1.0
X-Spam-Status: No, score=-6.776 tagged_above=-99.9 required=10 tests=[AWL=0.124, BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-2357-1290150463-1444.63136-5-0 [...] rt.cpan.org> (steven haryanto via RT's message of "Fri\, 19 Nov 2010 02\:07\:44 -0500")
X-Spam-Flag: NO
References: <RT-Ticket-63136 [...] rt.cpan.org> <rt-3.8.HEAD-2359-1290147287-1071.63136-4-0 [...] rt.cpan.org> <87lj4pessy.fsf [...] quad.sysarch.com> <rt-3.8.HEAD-2360-1290147769-1524.63136-5-0 [...] rt.cpan.org> <rt-3.8.HEAD-2357-1290150463-1444.63136-5-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <87eiahepnz.fsf [...] quad.sysarch.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.776
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id B73A4241111 for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Fri, 19 Nov 2010 02:30:32 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aVmOFWx0eiXb for <cpan-bug+File-Slurp [...] hipster.bestpractical.com>; Fri, 19 Nov 2010 02:30:30 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 68A0624110A for <bug-File-Slurp [...] rt.cpan.org>; Fri, 19 Nov 2010 02:30:30 -0500 (EST)
Received: (qmail 18074 invoked by uid 103); 19 Nov 2010 07:30:29 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 19 Nov 2010 07:30:29 -0000
Received: from vms173003pub.verizon.net (HELO vms173003pub.verizon.net) (206.46.173.3) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 18 Nov 2010 23:30:27 -0800
Received: from sysarch.com ([unknown] [96.237.162.42]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LC400DOXFIO4YM3 [...] vms173003.mailsrvcs.net> for bug-File-Slurp [...] rt.cpan.org; Fri, 19 Nov 2010 01:30:25 -0600 (CST)
Received: (qmail 5177 invoked by uid 1000); Fri, 19 Nov 2010 07:30:24 +0000
Delivered-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #63136] an autochomp reading mode?
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)
Return-Path: <uri [...] sysarch.com>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+File-Slurp [...] hipster.bestpractical.com
X-RT-Mail-Extension: file-slurp
Date: Fri, 19 Nov 2010 02:30:24 -0500
X-Spam-Level:
To: bug-File-Slurp [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
RT-Message-ID: <rt-3.8.HEAD-2358-1290151833-711.63136-0-0 [...] rt.cpan.org>
Content-Length: 1518
Download (untitled) / with headers
text/plain 1.4k
Show quoted text
>>>>> "shvR" == steven haryanto via RT <bug-File-Slurp@rt.cpan.org> writes:
Show quoted text
shvR> Queue: File-Slurp shvR> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=63136 >
Show quoted text
shvR> On Fri Nov 19 01:22:49 2010, uri@stemsystems.com wrote: shvR> Adding something like 'autochomp' option would certainly
Show quoted text
>> convenient: >>
Show quoted text
shvR> read_file('foo.txt', autochomp => 1).
Show quoted text
>> >> that is in my todo queue. a new release is due soon with a lot of >> fixes >> and interesting improvements. that one will go into the next release.
Show quoted text
shvR> Nice to know that a new release is imminent!
i need to finish up some cleaning up of a couple of tests and docs. but it still takes time i don't seem to have! Show quoted text
>> the problem with your idea is how do you autochomp multiple lines when >> slurping to a scalar? so that option will only work if you slurp to an >> array or array ref.
Show quoted text
shvR> You don't. In a scalar context, we can just chomp the whole file once. shvR> That makes perfect sense for one-line files in my case, and doesn't shvR> make much sense in a multiple-line files anyway. Of course we can chomp shvR> each line in array context.
well, i can enable it for scalars but it will only make sense for one line files. i will doc it that way. uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-18806-1306128188-1781.63136-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 29
done. reinstall it from cpan


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.