In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/37c07a4b201c9f799808d346817c4685e3e9002a?hp=eb96f3fadee7d30808d6e2287f5d03c7e2c02192>
- Log ----------------------------------------------------------------- commit 37c07a4b201c9f799808d346817c4685e3e9002a Author: Father Chrysostomos <[email protected]> Date: Mon Jan 30 12:33:31 2012 -0800 [perl #108780] Make /foo$qr/ work under âno overloadingâ This changes the code in pp_regcomp to use the underlying REGEXP instead of the reference to it, when concatenating pieces to mark a larger regular expression. This makes /foo$qr/ work even under âno overloadingâ. It stopped working with commit a75c6ed6b. ----------------------------------------------------------------------- Summary of changes: lib/overloading.t | 12 +++++++++++- pp_ctl.c | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/lib/overloading.t b/lib/overloading.t index 787edb1..85fc7e2 100644 --- a/lib/overloading.t +++ b/lib/overloading.t @@ -1,6 +1,6 @@ #./perl -use Test::More tests => 46; +use Test::More tests => 50; use Scalar::Util qw(refaddr); @@ -50,6 +50,16 @@ is( cos($x), "far side of overload table", "cosinusfies" ); is( 0 + $x, 42, "numifies" ); is( cos($x), "far side of overload table", "cosinusfies" ); + my $q = qr/abc/; + ok "abc" =~ $q, '=~ qr// with no "" overloading'; + ok "abcd" =~ /${q}d/, '=~ /foo$qr/ with no "" overloading'; + { + no overloading 'qr'; + my $q = qr/abc/; + ok "abc" =~ $q, '=~ qr// with no "" or qr overloading'; + ok "abcd" =~ /${q}d/, '=~ /foo$qr/ with no "" or qr overloading'; + } + { no overloading; is( "$x", overload::StrVal($x), "no stringification" ); diff --git a/pp_ctl.c b/pp_ctl.c index a99a78e..a679f41 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -130,6 +130,13 @@ PP(pp_regcomp) sv_setsv(tmpstr, sv); continue; } + + if (SvROK(msv) && SvTYPE(SvRV(msv)) == SVt_REGEXP) { + msv = SvRV(msv); + PL_reginterp_cnt += + RX_SEEN_EVALS((REGEXP *)MUTABLE_PTR(msv)); + } + sv_catsv_nomg(tmpstr, msv); } SvSETMAGIC(tmpstr); -- Perl5 Master Repository
