develooper Front page | perl.perl5.porters | Postings from April 2010

Re: Argument for Text::Trim as core module in upcoming Perl 5

Thread Previous | Thread Next
From:
Abigail
Date:
April 1, 2010 07:32
Subject:
Re: Argument for Text::Trim as core module in upcoming Perl 5
Message ID:
20100401143311.GH4812@almanda
On Fri, Mar 26, 2010 at 12:15:44AM +0100, Rafael Garcia-Suarez wrote:
> On 25 March 2010 23:42, smu johnson <smujohnson@gmail.com> wrote:
> > Dear p5p,
> >
> > In a nutshell:  For a while, I've been dreaming of having a whitespace
> > trimmer in Perl 5.  I am writing to state a case for why I believe the
> > addition of the Trim::Text core module, OR a {use v5.1x;} new function of
> > the Perl 6 trim function could be added to Perl 5 as given/when and say()
> > were.
> 
> I'd be more in favor of a new trim() builtin (enabled via feature). Reasons:
> - no new modules ! :)
> - faster, as it will be an opcode and hopefully not use regexps
> 
> Now, what kind of whitespace should it remove ? WWP6D ?


Well, the Perl5 way would be to remove whatever is in the magic variable
${^TRIM_REMOVE}, which is settable from userland.

After all, we do want to have enough rope to have situations where trim()
doesn't do what you expect it to do, while at the same time make trim()
flexible enough to have it play a prominent role in obfuscated code.



Abigail

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About