Creating an Atom feed in Perl

It seems like the people that should be positioning Atom as a format for everyday use might not be doing enough... Finding the latest specification for the Atom Syndication Format on Google is difficult: there are lots of different versions out there; is out of date and barely mentions, which still only has a text version of the specification.

The Perl modules on CPAN (XML::Atom and XML::Atom::SimpleFeed) are still stuck on Atom 0.3. Actually, I just noticed that XML::Atom::SimpleFeed has been taken over by another maintainer and now has an experimental version that produces Atom 1.0. XML::Atom also has experimental support for Atom 1.0, but it takes a bit of cleaning up to get it into a valid and non-crufty state:

$xml =~ s| xmlns=""||g;
$xml =~ s| xmlns=""||g;
$xml =~ s| xmlns:default=""||g;
$xml =~ s|<content mode="xml">|<content type="xhtml">|g;
$xml =~ s|<content mode="escaped">|<content type="html">|g;
$xml =~ s|<feed>|<feed xmlns="">|;

Here's an example of using XML::Atom to produce an Atom 1.0 feed:

use strict;
use XML::Atom;
use XML::Atom::Feed;
use XML::Atom::Entry;
use XML::Atom::Person;
use DateTime;
my $dt = DateTime->now;
my $now = $dt->ymd . 'T' . $dt->hms . 'Z';
my $feed = XML::Atom::Feed->new( Version => '1.0' );
$feed->title( 'Title of the Feed' );
$feed->subtitle('Description of the feed');
$feed->updated( $now );
my $self_link = XML::Atom::Link->new;
$self_link->href( 'http://' . $ENV{'SERVER_NAME'} . $ENV{'SCRIPT_NAME'} );
$feed->add_link( $self_link );
my $html_link = XML::Atom::Link->new;
$feed->add_link( $html_link );
my $author = XML::Atom::Person->new;
$author->name('Your Name');
$feed->author( $author );
foreach my $item (@items){
    my $date = "2005-$month-$day" . "T" . "$hour-$minute-$second" . "Z";
    my $entry = XML::Atom::Entry->new;
    $entry->title( $item_title );
    $entry->content( $item );
    $entry->link( $item_url );
    $entry->id( ",2005:item:$id" );
    $entry->updated( $date );
print "Content-type: application/atom+xml; charset=utf-8\n\n";