Subject: | Breaks on <item xmlns=""> |
# distribution
XML::RAI 0.51
# bug
Parsing an rdf with "<item xmlns="">" tags in it causes the following error when trying to call a method on an XML::RAI::Item object:
# error message
Can't call method "query" on an undefined value at /opt/local/lib/perl5/site_perl/5.8.4/XML/RAI/Object.pm line 38.
# test case
Show quoted text
> cat rss-bug.pl
#!/usr/bin/perl
use strict;
use warnings;
use XML::RAI;
use LWP::UserAgent;
my $url = 'http://www.newscientist.com/syndication/news.rdf';
my $ua = LWP::UserAgent->new;
my $request = new HTTP::Request( 'GET', $url );
my $response = $ua->request($request);
my $content = $response->content;
# uncommenting allows script to complete
#$content =~ s/<item xmlns="">/<item>/g;
my $rai = XML::RAI->parse( $content );
print scalar $_->title for @{$rai->items};
__END__
# perl version
Show quoted text>perl -v
This is perl, v5.8.4 built for darwin-2level
Show quoted text>uname -a
Darwin noras-computer.local 7.3.0 Darwin Kernel Version 7.3.0: Fri Mar 5 14:22:55 PST 2004; root:xnu/xnu-517.3.15.obj~4/RELEASE_PPC Power Macintosh powerpc
# patch
beyond my abilities! But thanks for the very helpful module