6
Dec
2004

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

Categories: Software

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;
$p1->setHandlers(
	Start => main::NodeStart,
	Char => main::NodeContent,
	End => main::NodeEnd
);

to

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.

 

Leave a Reply

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.