Newlines, XML::Pareser::Lite and ActiveState Perl can’t dance.

Dec 6th, 2004   11:21 am

So I’ve spent a good hour or two trying to find the source of the problem where

$blah  =~ s/[\r\n]//g

was giving me a GPF. I was using ActiveState Perl 5.6.x (and I tried 5.8.x) on Windows, and the variable contained what seemed to be regular characters. So I switched from the Lite to the full parser, and all was fine and dandy. Code changes were minimal. From

my( $p1 ) = new XML::Parser::Lite;
	Start => main::NodeStart,
	Char => main::NodeContent,
	End => main::NodeEnd


my( $p1 ) = new XML::Parser( Handlers=> {
	Start => &NodeStart,
	Char => &NodeContent,
	End => &NodeEnd }

. Everything else worked unmodified. Googling didn’t help at all, so maybe it is some weird combination of characters in the XML that upsets Lite.