munchie has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading and Formatting RSS Feed
by pzbagel (Chaplain) on Jul 02, 2003 at 16:02 UTC | |
|
Re: Reading and Formatting RSS Feed
by davorg (Chancellor) on Jul 02, 2003 at 15:53 UTC | |
|
Re: Reading and Formatting RSS Feed
by sauoq (Abbot) on Jul 02, 2003 at 15:51 UTC | |
|
Re: Reading and Formatting RSS Feed
by gellyfish (Monsignor) on Jul 03, 2003 at 11:04 UTC | |
|
Re: Reading and Formatting RSS Feed
by munchie (Monk) on Jul 02, 2003 at 15:51 UTC |