Front page | perl.perl5.porters |
Postings from January 2012
Re: [perl #108780] overload::StrVal and qr//
Thread Previous
|
Thread Next
From:
demerphq
Date:
January 26, 2012 10:05
Subject:
Re: [perl #108780] overload::StrVal and qr//
Message ID:
CANgJU+X2vQkS7H=aXZyjfuQPk0t_n6ofQwaMgKXnNKpWZhSrZQ@mail.gmail.com
Sorry to nag but this doesn't seem to test that 'no overloading'
stopped a qr => sub { qr/bcd/ } overload from firing...
Yves
On 26 January 2012 18:31, Father Chrysostomos via RT
<perlbug-followup@perl.org> wrote:
> On Wed Jan 25 13:51:23 2012, perl.p5p@rjbs.manxome.org wrote:
>> * demerphq <demerphq@gmail.com> [2012-01-25T16:15:01]
>> >
>> > Im all in favour of fixing instead of reverting if you can figure it
>> out.
>>
>> Same here, but once it's working nicely, I'd love to get davem to
>> chime in as
>> to whether the changes are going to cause him grief on his re-eval
>> work.
>
> Here is The Patch.
>
> --
>
> Father Chrysostomos
>
>
> ---
> via perlbug: queue: perl5 status: resolved
> https://rt.perl.org:443/rt3/Ticket/Display.html?id=108780
>
> diff --git a/lib/overloading.t b/lib/overloading.t
> index 787edb1..381a4d3 100644
> --- a/lib/overloading.t
> +++ b/lib/overloading.t
> @@ -1,6 +1,6 @@
> #./perl
>
> -use Test::More tests => 46;
> +use Test::More tests => 48;
>
> use Scalar::Util qw(refaddr);
>
> @@ -50,6 +50,10 @@ 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;
> 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);
> diff --git a/sv.c b/sv.c
> index 2dce137..93e3953 100644
> --- a/sv.c
> +++ b/sv.c
> @@ -2814,7 +2814,6 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags
> || amagic_is_enabled(string_amg)
> )) {
> REGEXP * const re = (REGEXP *)MUTABLE_PTR(referent);
> - I32 seen_evals = 0;
>
> assert(re);
>
> @@ -2825,9 +2824,6 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags
> else
> SvUTF8_off(sv);
>
> - if ((seen_evals = RX_SEEN_EVALS(re)))
> - PL_reginterp_cnt += seen_evals;
> -
> if (lp)
> *lp = RX_WRAPLEN(re);
>
>
--
perl -Mre=debug -e "/just|another|perl|hacker/"
Thread Previous
|
Thread Next