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

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

Thread Previous | Thread Next
Rafael Garcia-Suarez
May 30, 2003 08:56
Re: [PATCH] Extra newline in stringified qr/\#/x
Message ID:
"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 ?

> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About