I have and iPod, and I'm trying to write a program that will read RSS feeds, format them, and save them onto my iPod. I have no problem saving them to the iPod, but here's what I need help with: I've tried using XML::RSS::Parser in a program like this:
#!/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"; }
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,

-munchie


In reply to Reading and Formatting RSS Feed by munchie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.