in reply to Re^3: RegExp breaks in Perl 5.10
in thread RegExp breaks in Perl 5.10
So, is ${^RE_TRIE_MAXBUF} = -1; the most general work-around? What implications does it have? What other options do I have?
I think your best bet is to do what you've already done :) i.e. use UTF-8 everywhere and declare it as such, both in the script (use utf8;) and for the word list from the file. OTOH, declaring explicitly which legacy encoding you're using should work just as well (but then you'd miss that warm and fuzzy feeling of utilising state-of-the-art technologies :)
What apparently needs to be avoided due to the nature of the current bug in 5.10.0 is to rely on Perl auto-upgrading the strings at match time — which would have to occur if either side hasn't yet been upgraded. At least that's my conclusion.
With use encoding "iso-8859-1"; the literal strings in the script will be upgraded to character semantics at an earlier point in time, so the problem with the auto-upgrade becomes irrelevant. Moreover, in general it doesn't do any harm to make things explicit, i.e. tell Perl where it's supposed to assume which encodings (as a side effect, you'll have things documented without any further ado).
${^RE_TRIE_MAXBUF} = -1 simply disables the new trie optimizations, so essentially you'll then have what you always had before. That might be ok, too, but I'd probably only make use of it as a last resort — which should not be necessary, as there are better solutions like outlined above. Not only is it ugly having to mess with internal settings on a regular basis, it's also that if everyone would overcautiously default to disabling the new optimizations now that some issue has become known, it'd only take longer to find and weed out possibly remaining issues... (Sure, you might have a different take on this if stability is a major concern, but then you probably wouldn't use the newest and shiniest stuff anyway.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: RegExp breaks in Perl 5.10
by jfraire (Beadle) on Mar 07, 2008 at 20:02 UTC |