SPUG: XML::RSS error
tcaine at cac.washington.edu
tcaine at cac.washington.edu
Tue Sep 19 10:07:38 PDT 2006
The HTTP GET request may have failed. The SYNOPSIS for LWP::Simple has an
example of testing the return value of the get() call.
my $content = get($url);
die "Couldn't get it!" unless defined $content;
On Tue, 19 Sep 2006, luis medrano wrote:
> Here is the funny thing. I ran the script this morning and I didn't have any
> errors of any kind. My question is why this error is showing yesterday and
> not today.
>
> Here is the script:
>
> #!/usr/bin/perl
> use strict;
> use LWP::Simple;
> use XML::RSS;
> my @feeds;
> #yahoo_rss is a file with rss url such as this:
> #http://news.search.yahoo.com/news/rss?p=mac&ei=UTF-8&fl=0&x=wrt
> my $file_list="yahoo_rss.txt";
> open (FILE,$file_list) or die;
> my @list=<FILE>;
> close(FILE);
> foreach my $line (@list){
> chomp($line);
> my ($tmp,$yahoo)=split(/\t/,$line);
> push @feeds, $yahoo;
> }
>
>
>
>
> foreach my $url (@feeds){
> my $rss=XML::RSS->new();
> my $data=get($url);
> $rss->parse($data);
> my $channel=$rss->{channel};
> my $image=$rss->{image};
> foreach my $item(@{$rss->{items}}){
> my ($tmp,$link)=split(/\*/,$$item{link});
> $link=~s/\%3A/\:/g;
> print qq| <center><h3><a href
> ="$link">$$item{title}</a></h3></center></br></br>$$item{description}</br></br>|;
> }
>
> }
>
>
>
> On 9/18/06, Jeremy G. Kahn <kahn at cpan.org> wrote:
>>
>> It appears that your $data is probably empty or not valid XML. put in
>> some warnings after line 2 of your exmaple?
>>
>> or maybe post an entire test script?
>>
>> -jeremy
>>
>> luis medrano wrote:
>> > I trying to run this code:
>> >
>> > my $rss=XML::RSS->new();
>> > my $data=get($url);
>> > $rss->parse($data);
>> >
>> > but at the moment when I run this code I have this error:
>> >
>> > no element found at line 1, column 0, byte -1 at
>> > /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/XML/Parser.pm
>> > line 187
>> > $ vi
>> > /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/XML/Parser.pm
>> > $ vi
>> > /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi/XML/Parser.pm
>> > ------------------------------------------------------------------------
>> >
>> > _____________________________________________________________
>> > Seattle Perl Users Group Mailing List
>> > POST TO: spug-list at pm.org
>> > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>> > MEETINGS: 3rd Tuesdays
>> > WEB PAGE: http://seattleperl.org/
>>
>>
>
More information about the spug-list
mailing list