develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #128143] Inconsistent behaviour when decoding in substitution

Thread Previous | Thread Next
Dan Collins via RT
June 8, 2016 02:55
[perl #128143] Inconsistent behaviour when decoding in substitution
Message ID:
Dave, his attachment suggests that it's the other way around. Running his testcase shows me that the "odd one out" is the one corresponding to:


Surely, anything that $latin1->decode($1) does to trample on $1, Encode::decode('latin1', $1) will do as well? In fact, the first thing Encode::decode does is break the pass-by-reference with:

    my ( $name, $octets, $check ) = @_;

So either $latin1->decode doesn't break the reference, and modifies $1 by assigning to it, or it performs a match that Encode::decode('latin1', $1) doesn't, and modifies $1 through a regex match.

So, I ran a different testcase, Dumping $1 instead of the return from decode(), and all four testcases had only "\x80" in $1 - so it does not seem that $1 is being polluted by a pattern match in $latin1->decode(), nor does it seem that $1 is being changed by reference within $latin1->decode(), since each case should result in the attached modified test failing in some way.

I'll keep poking this, unless I'm missing something obvious.

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About