View ¡m../sdba/impages/RSSReader.first¡n
#HEAD: RSS-IM Reader <% use XML::RSS; use LWP::Simple; $NEXTPAGE = "RSSReader.first"; $RSSFeed = "http://sourceforge.net/export/rss2_sfnews.php?feed"; my $rss = new XML::RSS; # argument is a URL if ($RSSFeed=~ /http:/i) { $content = get($RSSFeed); imecho "Could not retrieve $RSSFeed" unless $content; # parse the RSS content $rss->parse($content); # treat it like a file } else { $file = $RSSFeed; imecho "File \"$file\" does't exist.\n" unless -e $file; # parse the RSS file $rss->parsefile($file); } imecho "\nFeed for: $rss->{'channel'}->{'title'}\n"; imecho "$rss->{'channel'}->{'link'}\n"; imecho "Here's the latest:\n"; # print the channel items foreach my $item (@{$rss->{'items'}}) { next unless defined($item->{'title'}) && defined($item->{'link'}); #Let's lose the newlines $item->{'title'} =~ s/\n//g; imecho " - $item->{'title'}\n$item->{'link'}\n"; } # if there's a copyright element if ($rss->{'channel'}->{'copyright'}) { imecho "\nCopyright $rss->{'channel'}->{'copyright'}"; } %>