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

Re: Marking a scalar as an unupgradable binary blob.

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
January 28, 2014 08:41
Subject:
Re: Marking a scalar as an unupgradable binary blob.
Message ID:
20140128084125.GZ22619@plum.flirble.org
On Tue, Jan 28, 2014 at 12:41:05PM +0800, demerphq wrote:
> [Retitled this to start a new thread.]

[Not read previous thread yet. Life excessively busy. Working to fix that.]

> My current thoughts are that this can be facilitated by attaching
> magic to the scalar and some minor patches to the appropriate parts of
> the internals.

Your suggestion makes me think that it might be doable purely in XS, and
possibly back to 5.8.0

As you suggest, attach magic to flag a scalar as "don't ever 'upgrade'".
Take advantage of PL_encoding. Set it to an object that has a "decode" method
that checks for this magic, and croaks if it finds it.

That *might* be enough.

(Patch any locations that don't currently check PL_encoding before calling
sv_recode_to_utf8(), or do the 'upgrade' some other way)

Nicholas Clark

Thread Previous | Thread Next


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