The above is the program listed in the documentation of XML::RSS::Parser. The program works fine, but I do not know how to use $p->items. In the documentation of XML::RSS::Parser, it says $p->items returns a reference to an array of hash references. How do you work with a refrence to an array of hash refrences? Refrences have always confused me, and I don't think the Camel explains it in simple enough terms. Thanks in advance,#!/usr/bin/perl -w use strict; use XML::RSS::Parser; use URI; use LWP::UserAgent; use Data::Dumper; my $ua = LWP::UserAgent->new; $ua->agent('XML::RSS::Parser Test Script'); my @places=( 'http://www.mplode.com/tima/xml/index.xml' ); my $p = new XML::RSS::Parser; foreach my $place ( @places ) { # retreive feed my $url=URI->new($place); my $req=HTTP::Request->new; $req->method('GET'); $req->uri($url); my $feed = $ua->request($req); # parse feed $p->parse( $feed->content ); # print feed title and items data dump to screen print $p->channel->{ $p->ns_qualify('title', $p->rss_namespace +_uri ) }."\n"; my $d = Data::Dumper->new([ $p->items ]); print $d->Dump."\n\n"; }
In reply to Reading and Formatting RSS Feed by munchie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |