Skip Menu |

This queue is for tickets about the Text-Chomped CPAN distribution.

Report information
The Basics
Id: 129721
Status: new
Priority: 0/
Queue: Text-Chomped

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

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



Subject: Proposed enhancement: handle $_
Robert, Thanks for writing this module! I played around with the prototypes some and found a setup that can also handle chomping $_, e.g., in `map { chomped } "a\n", "b";`. Full report with testcases is at https://github.com/robertkrimen/Text-Chomped/issues/1 ; I am opening here as well in case this reaches you sooner. The proposed code is: sub chomped(;+) { my @retvals; @_ = @{$_[0]} if ref $_[0] eq 'ARRAY'; unshift @_, $_ unless @_; foreach my $val (@_) { my $s = $val; chomp $s; push @retvals, $s; } return $#retvals ? @retvals : $retvals[0]; } I am working on this in a fork at https://github.com/cxw42/Text-Chomped/tree/issue1 . Is this enhancement of interest to you? Thanks! Chris White
Robert, PR open at https://github.com/robertkrimen/Text-Chomped/pull/3 . I would be happy to take care of the release if you would be willing to give me co-maint (and, if possible, push access to the repo). Let me know either way; thanks! Chris On Fri May 31 10:18:26 2019, CXW wrote: Show quoted text
> Robert, > > Thanks for writing this module! I played around with the prototypes > some and found a setup that can also handle chomping $_, e.g., in `map > { chomped } "a\n", "b";`. Full report with testcases is at > https://github.com/robertkrimen/Text-Chomped/issues/1 ; I am opening > here as well in case this reaches you sooner. The proposed code is: > > sub chomped(;+) { > my @retvals; > @_ = @{$_[0]} if ref $_[0] eq 'ARRAY'; > unshift @_, $_ unless @_; > foreach my $val (@_) { > my $s = $val; > chomp $s; > push @retvals, $s; > } > return $#retvals ? @retvals : $retvals[0]; > } > > I am working on this in a fork at https://github.com/cxw42/Text- > Chomped/tree/issue1 . Is this enhancement of interest to you? > Thanks! > > Chris White