http://qs1969.pair.com?node_id=178131

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I wrote a small script to publish an rss document using XML::RSS. I used some of the code from the cpan documentation to write my script. It works great except this one little problem I am having. When my xml file gets to 15 items it does not remove the oldest and insert a new entry. Thanks in advance!
$rss->parsefile($rss_output); pop(@{$rss->{'items'}}) if (@{$rss->{'items'}} == 15); $rss->add_item(title => $title, link => $rss_link, description => $desc, mode => 'insert' );

Replies are listed 'Best First'.
Re: XML::RSS question
by mikeirw (Pilgrim) on Jun 28, 2002 at 21:27 UTC
    Hmmm...the code looks right. What exactly does it do when your RSS file contains 15 headlines?
      Nothing =) It doesn't add any new entries or delete any old ones.
        I'm not sure what the problem is with the code you've posted. Are you trying to write out a RSS file, or just read one in? Can you post the rest of your script?