develooper Front page | perl.perl5.porters | Postings from January 2012

Re: pat.t warning (Re: [perl.git] branch blead, updated. v5.15.7-90-g69a8a23)

From:
demerphq
Date:
January 28, 2012 14:46
Subject:
Re: pat.t warning (Re: [perl.git] branch blead, updated. v5.15.7-90-g69a8a23)
Message ID:
CANgJU+We9XK7AqEKQVDQQqK6TOebUdtp41p5SuuRbTC4OZLZVg@mail.gmail.com
On 28 January 2012 15:42, Craig A. Berry <craigberry@mac.com> wrote:
> In article <E1RqfMI-0006Nd-BX@camel.ams6.corp.booking.com>,
>  sprout@cpan.org ("Father Chrysostomos") wrote:
>
>>
>> commit cc88c9aaa7ecb8334614c515caf0da2d5538403b
>> Author: Father Chrysostomos <sprout@cpan.org>
>> Date:   Thu Jan 26 16:31:53 2012 -0800
>>
>>     pat.t: Test that . overloading gets passed qr ref
>>
>>     This is something that my sample patch in ticked #108780 (for
>>     fixing /foo$qr/ under ‘no overloading’) would have broken had it
>>     been applied.
>>
>> M     t/re/pat.t
>> -----------------------------------------------------------------------
>
>
>> diff --git a/t/re/pat.t b/t/re/pat.t
>> index 7b03e41..6c4cd1a 100644
>> --- a/t/re/pat.t
>> +++ b/t/re/pat.t
>> @@ -21,7 +21,7 @@ BEGIN {
>>      require './test.pl';
>>  }
>>
>> -plan tests => 465;  # Update this when adding/deleting tests.
>> +plan tests => 466;  # Update this when adding/deleting tests.
>>
>>  run_tests() unless caller;
>>
>> @@ -1222,6 +1222,23 @@ EOP
>>       eval ' sub { my @a =~ // } ';
>>      }
>>
>> +    { # Concat overloading and qr// thingies
>> +     my @refs;
>> +     my $qr = qr//;
>> +     package Cat {
>> +         use overload
>> +             '""' => sub { ${$_[0]} },
>> +             '.' => sub {
>> +                 push @refs, ref $_[1] if ref $_[1];
>> +                 bless $_[2] ? \"$_[1]${$_[0]}" : \"${$_[0]}$_[1]"
>> +             }
>> +     }
>> +     my $s = "foo";
>> +     my $o = bless \$s, Cat::;
>> +     /$o$qr/;
>> +     is "@refs", "Regexp", '/$o$qr/ passes qr ref to cat overload meth';
>> +    }
>> +
>>  } # End of sub run_tests
>
> This causes the following warning:
>
> % ./perl -I../lib re/pat.t
> Variable "@refs" will not stay shared at re/pat.t line 1232.
> 1..466
> ok 1 - "abc\ndef\n" =~ /^abc/
> ok 2 - "abc\ndef\n" !~ /^def/
>
> That's on OS X.  On VMS I see the same warning but the test suite chokes
> on it with "unexpected output at test 0" and the test fails.

I see it too on Linux. I pushed a patch to fix it just now:

3bbc3d3032212ca88eda829355f4e66179b013ad

cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About