Perl 5.6.2 hates me

grantm on 2008-08-05T11:06:29

I was feeling virtuous for having finally made the time to address the RT queue for XML::SAX. After resolving 7 tickets I pushed out a new release and within about an hour I'd learned from the CPAN testers that the new release doesn't work with 5.6 (yay for CPAN testers!). The thing that's puzzling me is that I can't see how it ever worked.

Having compiled up a 'fresh' copy of Perl v5.6.2, I'm now able to see what the CPAN Testers are seeing. Here's a minimal test case:

$ perl -le 'q{TEST} =~/^[\x{0041}-\x{005A}]+$/ && print q{OK}'
Invalid [] range "}-\x" before HERE mark in regex m/^[\x{0041}-\x << HERE {005A}]+$/

The same thing works as expected on 5.8. The XML::SAX::PurePerl parser makes extensive use of this syntax (character classes which include ranges of unicode characters) to match productions such as these from the XML spec. It's been that way since 2002 and apparently working (modulo a few bugs). Indeed if I go back to the code in the previous release it passes all the tests - even with regexes that look like that.

I'm going to bed and hoping this makes more sense in the morning.


Duh!

grantm on 2008-08-05T12:13:44

I tossed and turned in bed for a while and suddenly the solution was obvious:

$ perl -le 'use utf8; q{TEST} =~/^[\x{0041}-\x{005A}]+$/ && print q{OK}'
OK

How soon we forget!

Re:Duh!

sigzero on 2008-08-05T13:35:54

I can't tell you how many times something similar has happened to me. I keep a notepad by the bed when that happens as I know I will popup from sleep with an "Ah ha!".

Back to bed

grantm on 2008-08-05T12:48:06

Now that's resolved and I've uploaded a new release I can go back to bed :-)