develooper Front page | perl.perl5.porters | Postings from May 2008

Re: [perl #51370] Clearing magic (was: [#perl 51370] length($@)>0 for empty $@ if utf8 is in use)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 5, 2008 02:06
Subject:
Re: [perl #51370] Clearing magic (was: [#perl 51370] length($@)>0 for empty $@ if utf8 is in use)
Message ID:
20080505090621.GD84051@plum.flirble.org
On Mon, May 05, 2008 at 09:17:35AM +0200, Bram wrote:
> Quoting Nicholas Clark <nick@ccl4.org>:

> >Mmm, in the end, reading the documentation and the source, should every
> >sv_setpvn(ERRSV, ...); become sv_setpvn_mg(ERRSV, ...), and
> >sv_catsv(ERRSV, ...) become sv_catsv_mg(ERRSV, ...) ?
> >Will that solve it?
> 
> As noted in my original messages: that will solve the length issue but  
> then $@ still has the extra flags/magic set.

It doesn't matter if it has the UTF-8 length caching magic still in place,
when the value is not UTF-8, providing the magic has had its "set" method
called correctly, because then the cache will be marked as void.

There wasn't any other magic involved, was there?

> I'm completly clueless if that would be a problem or not.
> (Rafael replied to that that it actually should be sv_setpvn)

Yes, and I'm now not sure why. To my mind, making them all *_mg seems right,
as it would trigger any set magic on ERRSV.

Although (I think) that this would allow rather sick things like tie $@ to
work.

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