htaccess has asked for the wisdom of the Perl Monks concerning the following question:

Hi I want to aggregate a bunch of blogger derived blogs that are avalible as atom.xml feeds to html (making this page avalible as an atom feed is not required). Think is I can't work out how to do it from the cpan documentation on account of my lack of mental powers. I was hoping someone could post a quick atom2html.pl to get me started :) use XML::Atom::Entry; looks promising but I dont get why the title and stuff are defined, shurley this is defined in the feed. To get an entry object seems to need use XML::Atom::Client; and my $entry = $api->getEntry($EditURI); type thing. but once I have an entry what do i do with it?

Edit by castaway - changed title from "Atom::XML Usage"

Replies are listed 'Best First'.
Re: XML::Atom Usage
by Aragorn (Curate) on Mar 24, 2004 at 11:12 UTC
    Indeed, the docs aren't very clear on how things work. Nevertheless, I managed to create a small example of how to get to the content of entries:
    #!/usr/bin/perl use strict; use warnings; use XML::Atom::Feed; use XML::Atom::Entry; use Text::Wrap; my $feed = XML::Atom::Feed->new("/home/arjen/atomfeed.xml"); foreach my $entry ($feed->entries()) { print "* ", $entry->title(), "\n"; my $body = $entry->content()->body(); $body =~ s/^\s*//g; $body =~ s/\s*^//g; print wrap('', '', $body), "\n\n"; }
    The file /home/arjen/atomfeed.xml is a file with the contents of the Atom feed of Perl.com. You'd have to change to your own file, of course :-)

    It isn't HTML, but I think this is a nice starting point.

    Arjen