Good review, and very helpful.
One question though. Rather than writing to a file is it possible to simply write to a variable. I've been trying to determine how to do this, and I've had no luck.
Thanks
This requires IO::String, but this is one method to put the value of the output into a string:
my $xml;
my $output = IO::String->new($xml);
my $w = new XML::Writer(OUTPUT => $output,
... etc