Skip Menu |

This queue is for tickets about the Encode CPAN distribution.

Report information
The Basics
Id: 80131
Status: resolved
Priority: 0/
Queue: Encode

People
Owner: Nobody in particular
Requestors: RCAPUTO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.47
Fixed in: (no value)



Subject: !LEAVE_SRC writes wrong data to original value
In the following one-liner, encode() returns the string "ascii" but overwrites the source variable with an empty string. perl -MEncode -wle 'use strict; my $src = "ascii"; my $new = Encode::decode("UTF-8", $src, Encode::FB_CROAK); print "new: $new"; print "src: $src"' new: ascii src: It could be considered technically okay because the docs for Encode::LEAVE_SRC only say that the source string will be "overwritten in place". It doesn't say what will overwrite it.
I have fixed the POD as follows. Should be more descriptive. Dan the Maintainer Thereof @@ -797,7 +798,7 @@ Encode::LEAVE_SRC If the C<Encode::LEAVE_SRC> bit is I<not> set but I<CHECK> is set, then the -second argument to encode() or decode() will be overwritten in place. +source string to encode() or decode() will be overwritten in place. If you're not interested in this, then bitwise-OR it with the bitmask. On Thu Oct 11 11:32:33 2012, RCAPUTO wrote: Show quoted text
> In the following one-liner, encode() returns the string "ascii" but > overwrites the source variable > with an empty string. > > perl -MEncode -wle 'use strict; my $src = "ascii"; my $new = > Encode::decode("UTF-8", $src, > Encode::FB_CROAK); print "new: $new"; print "src: $src"' > > new: ascii > src: > > It could be considered technically okay because the docs for > Encode::LEAVE_SRC only say that > the source string will be "overwritten in place". It doesn't say what > will overwrite it.