Comments

Hey! You're not going to let jjohn get away with writing that kind of garbage, are you? They say that helpful criticism is the best antidote to error. Begin administering your cure now.

All comments are moderated before posting.

Only the following HTML tags are allowed:
<B> <I> <EM> <UL> <OL> <LI> <A> <P> <BLOCKQUOTE>

Name   :  
Web site or email   :  
Subject   :  
Body   :  


XML::RSS parsing error

If you are using the Perl module XML::RSS in the following way:

my $R = XML::RSS->new;
foreach my $url (@urls) {
  my $content = wget($url);
  $R->parse($content);
}

In older versions of the XML::RSS module, this code worked fine. However, if you have upgraded the module recently, you might have noticed the error message: Modification of non-creatable array value attempted, subscript -1 at /usr/local/lib/perl5/site_perl/5.8.5/XML /RSS.pm line 792.

It is not the feed that has gone rancid on you, but the library. Try instantiating a RSS object within the loop like this:

foreach my $url (@urls) {
  my $content = wget($url);
  my $R = XML::RSS->new;
  eval{$R->parse($content)};
  if ($@) {
    warn("Parse error: $@");
    next;
  }
}

I've added some "exception" handling for free in this example so that parse errors don't blow up your program.

I'm afraid I did not dive into XML::RSS.pm to figure out the problem, but if someone with that knowledge wishes to post below, I'm sure won't be the only one who welcomes enlightenment.