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

Howdy Monks. I'm trying to get and parse and Atom feed, with confusing results. When I run this
use strict; use XML::Atom::Feed; my $url = 'http://terrorism-news.blogspot.com'; my $feed = XML::Atom::Feed->new(URI->new($url)) or die XML::Atom::Feed->errstr; my @entries = $feed->entries;
I get the following object
$feed = { elem => 'XML::Atom::Feed', ns => 'XML::XPath::Node::Element', version => 0.3 }
and @entries is null. Same result with I parse the actual feed address with XML::Feed. This is confusing because it seems to be detecting the correct NS and version, etc., but then not actually parsing the page. As far as I can tell from the docs this is how it's done. What's the problem?

TIA....Stevve

Replies are listed 'Best First'.
Re: XML::Atom feed parsing problem
by LTjake (Prior) on Mar 20, 2007 at 23:38 UTC

    I added use LWP::Debug qw(+) to the code to see the network traffic in which i found:

    LWP::UserAgent::send_request: GET http://terrorism-news.blogspot.com/ ... LWP::UserAgent::send_request: GET http://terrorism-news.blogspot.com/f +eeds/posts/default

    So it appears to be getting the feed. I also did a dump of $entries[ 0 ] which gave me:

    $VAR1 = bless( { 'ns' => 'http://www.w3.org/2005/Atom', 'elem' => bless( do{\(my $o = 140714248)}, 'XML::LibX +ML::Element' ), 'version' => '0.3' }, 'XML::Atom::Entry' );

    So....works for me! Sorry.

    --
    "Go up to the next female stranger you see and tell her that her "body is a wonderland."
    My hypothesis is that she’ll be too busy laughing at you to even bother slapping you.
    " (src)

      Hmm...strange. Stranger still, I switched to XML::FeedPP and that works fine. So the practical problem is solved, but I can't explain the original problem!