# ---------------------------------------------------------------- use strict; use Test::More tests => 23; BEGIN { use_ok('XML::FeedPP') }; # ---------------------------------------------------------------- # Sample Atom 1.0 sources from http://www.ietf.org/rfc/rfc4287 # ---------------------------------------------------------------- { my $sample = <<'EOT'; Example Feed 2003-12-13T18:30:02Z John Doe urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 Atom-Powered Robots Run Amok urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a 2003-12-13T18:30:02Z Some text. EOT my $feed = XML::FeedPP->new( $sample ); ok( $feed->isa( 'XML::FeedPP::Atom::Atom10' ), 'XML::FeedPP::Atom::Atom10' ); is( $feed->title, 'Example Feed', 'feed title' ); is( $feed->link, 'http://example.org/', 'feed link' ); is( $feed->pubDate, '2003-12-13T18:30:02Z', 'feed pubDate' ); # is( $feed->author, 'John Doe', 'feed author' ); # is( $feed->guid, 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', 'feed guid' ); my @entry = $feed->get_item; is( scalar(@entry), 1, 'feed get_item' ); my $item = shift @entry; is( $item->title, 'Atom-Powered Robots Run Amok', 'item title' ); is( $item->link, 'http://example.org/2003/12/13/atom03', 'item link' ); is( $item->guid, 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', 'item guid' ); is( $item->pubDate, '2003-12-13T18:30:02Z', 'item pubDate' ); is( $item->description, 'Some text.', 'item description' ); } # ---------------------------------------------------------------- { my $sample = <<'EOT'; dive into mark A <em>lot</em> of effort went into making this effortless 2005-07-31T12:29:29Z tag:example.org,2003:3 Copyright (c) 2003, Mark Pilgrim Example Toolkit Atom draft-07 snapshot tag:example.org,2003:3.2397 2005-07-31T12:29:29Z 2003-12-13T08:29:29-04:00 Mark Pilgrim http://example.org/ f8dy@example.com Sam Ruby Joe Gregorio

[Update: The Atom draft is finished.]

EOT my $feed = XML::FeedPP->new( $sample ); ok( $feed->isa( 'XML::FeedPP::Atom::Atom10' ), 'XML::FeedPP::Atom::Atom10' ); is( $feed->title, 'dive into mark', 'feed title' ); like( $feed->description, qr/effortless/, 'feed description' ); is( $feed->pubDate, '2005-07-31T12:29:29Z', 'feed pubDate' ); # is( $feed->guid, 'tag:example.org,2003:3', 'feed guid' ); is( $feed->link, 'http://example.org/', 'feed link' ); is( $feed->copyright, 'Copyright (c) 2003, Mark Pilgrim', 'feed copyright' ); my @entry = $feed->get_item; is( scalar(@entry), 1, 'feed get_item' ); my $item = shift @entry; is( $item->title, 'Atom draft-07 snapshot', 'item title' ); is( $item->link, 'http://example.org/2005/04/02/atom', 'item link' ); is( $item->guid, 'tag:example.org,2003:3.2397', 'item guid' ); is( $item->pubDate, '2005-07-31T12:29:29Z', 'item pubDate' ); is( $item->author, 'Mark Pilgrim', 'item author' ); } # ---------------------------------------------------------------- ;1; # ----------------------------------------------------------------