1use strict; 2use warnings; 3 4use XML::Atom::SimpleFeed; 5use Test::More tests => 1; 6BEGIN { eval { require Test::LongString; Test::LongString->import; 1 } or *is_string = \&is; } 7 8my $g = XML::Atom::SimpleFeed::DEFAULT_GENERATOR; 9 10my $feed = XML::Atom::SimpleFeed->new( 11 title => 'Example Feed', 12 link => 'http://example.org/', 13 link => { rel => 'self', href => 'http://example.org/atom', }, 14 updated => '2003-12-13T18:30:02Z', 15 author => 'John Doe', 16 id => 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', 17); 18 19$feed->add_entry( 20 title => 'Atom-Powered Robots Run Amok', 21 link => 'http://example.org/2003/12/13/atom03', 22 id => 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a', 23 summary => 'Some text.', 24 updated => '2003-12-13T18:30:02Z', 25 category => 'Atom', 26 category => 'Miscellaneous', 27); 28 29is_string $feed->as_string."\n", << "", 'synopsis code produces expected output'; 30<?xml version="1.0" encoding="us-ascii"?> 31<feed xmlns="http://www.w3.org/2005/Atom"><title>Example Feed</title><link href="http://example.org/"/><link href="http://example.org/atom" rel="self"/><updated>2003-12-13T18:30:02Z</updated><author><name>John Doe</name></author><id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id><generator uri="$g->{'uri'}" version="$g->{'version'}">$g->{'name'}</generator><entry><title>Atom-Powered Robots Run Amok</title><link href="http://example.org/2003/12/13/atom03"/><id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id><summary>Some text.</summary><updated>2003-12-13T18:30:02Z</updated><category term="Atom"/><category term="Miscellaneous"/></entry></feed> 32 33