develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [PATCH] Extra newline in stringified qr/\#/x

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
May 30, 2003 08:56
Subject:
Re: [PATCH] Extra newline in stringified qr/\#/x
Message ID:
20030530175309.13c0af78.rgarciasuarez@free.fr
"Orton, Yves" wrote:
> On the contrary. The ability to stringify a regex is a crucial aspect power
> and flexibility of perls regexes.
> 
> Consider the following.... (conceptual demonstration):
> 
> my $iso_date_capture=qr!(\d{4})[-/\\](\d{2})[-/\\](\d{2})!;
> (my $iso_date_match=$iso_date_capture)=~s/\((?:\?[msiox-]*\:)?/(?:/g;
> $iso_date_match=qr/$iso_date_match/;
> 
> print $iso_date_capture,"\n";
> print $iso_date_match,"\n";

Cool. Never used that.
In this case, the fact that qr// objects can be stringified should
probably be documented somewhere.
What do you think about Alex' patch then ? Does it count for an argument
against it ?

[but...]
> Even the magic pointer is still there the stringification lookup is
> hardcoded against the package 'Regexp'.
> 
> I put a patch together (and a module) ages ago, but I never polished them
> enough to publish.

I don't remember having seen it.

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