Take advantage of the XML::RSS CPAN package, which is specifically designed to read and parse RSS feeds.
You've probably already heard of RSS, the XML-based format which allows Web sites to publish and syndicate the latest content on their site to all interested parties. RSS is a boon to the lazy Webmaster, because (s)he no longer has to manually update his or her Web site with new content.
Instead, all a Webmaster has to do is plug in an RSS client, point it to the appropriate Web sites, and sit back and let the site "update itself" with news, weather forecasts, stock market data, and software alerts. You've already seen, in previous articles, how you can use the ASP.NET platform to manually parse an RSS feed and extract information from it by searching for the appropriate elements. But I'm a UNIX guy, and I have something that's even better than ASP.NET. It's called Perl.
Installing XML::RSS
RSS parsing in Perl is usually handled by the XML::RSS CPAN package. Unlike ASP.NET, which comes with a generic XML parser and expects you to manually write RSS-parsing code, the XML::RSS package is specifically designed to read and parse RSS feeds. When you give XML::RSS an RSS feed, it converts the various <item>s in the feed into array elements, and exposes numerous methods and properties to access the data in the feed. XML::RSS currently supports versions 0.9, 0.91, and 1.0 of RSS.
Written entirely in Perl, XML::RSS isn't included with Perl by default, and you must install it from CPAN. Detailed installation instructions are provided in the download archive, but by far the simplest way to install it is to use the CPAN shell, as follows:
shell> perl -MCPAN -e shell
cpan> install XML::RSS
If you use the CPAN shell, dependencies will be automatically downloaded for you (unless you told the shell not to download dependent modules). If you manually download and install the module, you may need to download and install the XML::Parser module before XML::RSS can be installed. The examples in this tutorial also need the LWP::Simple package, so you should download and install that one too if you don't already have it.
Basic usage
For our example, we'll assume that you're interested in displaying the latest geek news from Slashdot on your site. The URL for Slashdot's RSS feed is located here. The script in Listing A retrieves this feed, parses it, and turns it into a human-readable HTML page using XML::RSS:
Listing A
Place the script in your Web server's cgi-bin/ directory/. Remember to make it executable, and then browse to it using your Web browser. After a short wait for the RSS file to download, you should see something like Figure A.
Slashdot RSS feed
Do you need help with XML? 





1
Andrey Car - 26/02/05
I think that your code is wrong example A and B are the same. I would like to see how the example B was done.
Thanks
Andrey
» Report offensive content
2
Andrey Car - 26/02/05
I think that your code is wrong example A and B are the same. I would like to see how the example B was done.
Thanks
Andrey
» Report offensive content
3
pande - 10/05/07
the tutorial is very hard use simpler language
» Report offensive content
4
JhonOrton - 25/07/08
Data recovery uk experts recover data from desKtop hard drive, laptop hard drives, RAID arrays, tapes with all operating systems
» Report offensive content
5
nano rycy - 28/04/09
Flobo Recovery is the leading provider of powerful data
recovery, drive image, HDD repair and PC privacy utilities
for the Windows OS family. All Flobo software titles are
listed below.Trial versions of each program can be
downloaded free of charge by using the Download link above
or the FREE Trial link listed with each product. Use the
Buy It! link to securely purchase any Flobo product and
download right to your desktop
» Report offensive content
6
andrew - 17/08/10
Perfumes, fragrances and colognes at discount rates for men & women. Online Perfum store with secure shopping, Brand names designer perfume for sale
» Report offensive content