On Wed Sep 26 09:08:38 2012, perl@profvince.com wrote: > > > Even if we fix length magic to set the utf8 flag we will still have a > > problem with get-magic being called too many times in those cases where > > length magic falls back to get-magic. There is no way to tell > > afterwards whether length magic resorted to get-magic or not. > > One possible solution would be to replace mg_length() by a new > mg_length_flags() function that would take a 'flags' parameter telling > it whether it can call 'get' magic if no 'len' magic is available. I'm > not sure it's worth the trouble though. Probably not. Anyway, this is worse than I thought: sv_len calls mg_length on gmagical variables, and returns the byte length otherwise. mg_length calls length magic if available, and returns the number of *characters* otherwise. Length magic on match vars (the only scalar length magic) returns the length in bytes. I’ve locally changed sv_len to stop calling mg_length, but mg_length is an API function, so I cannot just remove it. But what *should* it do? It currently returns bytes for $1 but characters for $^A. -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=114690Thread Previous | Thread Next