Subject: | regexp error parsing certain feed (forwarded from user) |
The file below run as "perl bar.pl" gets an error
Unmatched [ in regex; marked by <-- HERE in m/![ <-- HERE CDATA[/ at
/usr/share/perl5/XML/RSSLite.pm line 266.
I suspect the parsing somehow lets "CDATA[" get in as a tag to be
matched, or skipped. I know rsslite doesn't handle cdata, but I think a
little quoting can protect it against evil tags (or apparent tags). I
got some joy from the diff below.
I struck this at a feed
http://rss.weather.com.au/sa/adelaide
Subject: | bar.pl |
use strict;
use XML::RSSLite;
my %feed;
my $xml = '<?xml version="1.0"?>
<rss version="2.0">
<channel>
<item>
<description>
<![CDATA[
<b>something bold</b> <br />
]]>
</description>
</item>
</channel>
</rss>
';
parseRSS(\%feed, \$xml);
print $feed{'item'}->{'link'};