summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-01-24 10:24:21 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-01-24 10:34:39 -0800
commita75c6ed6bbe8051aad5c980a7e52906076b66543 (patch)
tree5dd08c21fda93de08484d682673066da0836f4b5 /sv.c
parent8d5692911401401dd403c3c2aa0aa3eca63171a4 (diff)
downloadperl-a75c6ed6bbe8051aad5c980a7e52906076b66543.tar.gz
[perl #108780] Make ‘no overloading’ work with qr//
Traditionally, overload::StrVal(qr//) has returned Regexp=SCALAR(0xc0ffee), and later Regexp=REGEXP(0xc0c0a) when regexps were made into first-class SVs. When the overloading pragma was added in 5.10.1, qr// things were not accounted for, so they would still stringify as (?-xism:) even with ‘no overloading’ (or as (?^:) under 5.14). This commit makes the overloading pragma work with qr// things, so that they stringify the same way as overload::StrVal; i.e., as Regexp=REGEXP(0xbe600d).
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index c1ece77d99..2dce137220 100644
--- a/sv.c
+++ b/sv.c
@@ -2809,7 +2809,10 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags
if (!referent) {
len = 7;
retval = buffer = savepvn("NULLREF", len);
- } else if (SvTYPE(referent) == SVt_REGEXP) {
+ } else if (SvTYPE(referent) == SVt_REGEXP && (
+ !(PL_curcop->cop_hints & HINT_NO_AMAGIC)
+ || amagic_is_enabled(string_amg)
+ )) {
REGEXP * const re = (REGEXP *)MUTABLE_PTR(referent);
I32 seen_evals = 0;