summaryrefslogtreecommitdiff
path: root/rss_read.pl
blob: ef13dea0373e9579a5c9635c25b5a0dd1037d984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 #!/usr/bin/perl -w
 use strict;
 
 use XML::RSS::Parser;
 use FileHandle;
 
 my $p = XML::RSS::Parser->new;
 my $fh = FileHandle->new('/path/to/some/rss/file');
 my $feed = $p->parse_file($fh);
 
 # output some values 
 my $feed_title = $feed->query('/channel/title');
 print $feed_title->text_content;
 my $count = $feed->item_count;
 print " ($count)\n";
 foreach my $i ( $feed->query('//item') ) { 
     my $node = $i->query('title');
     print '  '.$node->text_content;
     print "\n"; 
 }