On Mon Jul 30 08:26:47 2007, david.morel@amakuru.net wrote:
Show quoted text> Short self-explainatory example:
>
> david@MoMac david $ perl -MRegexp::Assemble -e '$re=Regexp::Assemble-
> >new();$re->flags
> ("xism");$re->add("[/?&;]");print $re'
> Segmentation fault
> david@MoMac david $ perl -MRegexp::Assemble -e '$re=Regexp::Assemble-
> >new();$re->flags
> ("xism");$re->add("[?&;]");print $re'
> (?msix:[?&;])
>
> Bug reproduced on various versions of 5.8 with latest version of R:A
Eeeek!
The following patch will correct this problem, and it's probably better
anyway.
--- /usr/local/lib/perl5/site_perl/5.8.8/Regexp/Assemble.pm Fri May
18 18:20:35 2007
+++ Assemble.pm Mon Jul 30 16:55:28 2007
@@ -977,7 +977,8 @@
else {
# how could I not repeat myself?
$self->{re} = length $self->{flags}
- ? eval "qr/$str/$self->{flags}"
+ # eval "qr/$str/$self->{flags}"
+ ? qr/(?$self->{flags}:$str)/
: qr/$str/
;
}
I introduced an eval block in _build_re() so that your resulting pattern
would be just
(?xism:[/?&;])
instead of
(?-xism:(?xism:[/?&;]))
... because you cannot add flags to a qr// quoted string. I always
thought this was kind of icky, so I shall back this change out in the
next release. In the meantime, if you are able to apply to patch to your
own file, this will be sufficient to get you going.
Sorry about that, and thanks for taking the time to file the report.
David Landgren