How can I create a qr// in Perl 5.12 from C?
- by kristina
This has been working for me in 5.8 and 5.10, but in 5.12 my code creates this weird non-qr object:
# running "print Dumper($regex)"
$VAR1 = bless( do{\(my $o = '')}, 'Regexp' );
Whereas printing a qr// not created by my code looks like this:
# running "print Dumper(qr/foo/i)"
$VAR1 = qr/(?i-xsm:foo)/;
My code is basically:
REGEXP *rx = re_compile(pattern, flags);
SV *regex = sv_2mortal(newSVpv("",0));
sv_magic(regex, (SV*)rx, PERL_MAGIC_qr, 0, 0);
stash = gv_stashpv("Regexp", 0);
sv_bless(newRV((SV*)regex), stash);
Anyone know how to correctly create a regex from a string in 5.12?