[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple example for RSSLite



I realized I never included a simple example for RSSLite. Here's one,
which you can also find at http://industrial-linux.org/RSSLite/sample.pl .
It simply prints the title/description/url for both the channel and items
in a metafile. It works with RDF, RSS, scriptingNews, or Weblog formats.

Enjoy!
---scott

#!/usr/bin/perl -w -I.

use LWP::Simple;
use RSSLite;

my $content = get('http://www.vex.net/parnassus/parnassus.rss')
  or die "Can't get the content!";

my %result;

parseXML(\%result, \$content);

print "=== Channel ===\n",
      "Title: $result{'title'}\n",
      "Desc:  $result{'description'}\n",
      "Link:  $result{'link'}\n\n";

my $item;
foreach $item (@{$result{'items'}}) {
  print "  --- Item ---\n",
        "  Title: $item->{'title'}\n",
        "  Desc:  $item->{'description'}\n",
        "  Link:  $item->{'link'}\n\n";
}