use strict; use warnings; use XML::Maker; my $xml = XML::Maker->new ('Body'); my $foo = $xml->subtag ('Foo'); $foo->subtag ('Bar'); print $xml->make (); #### Bar #### use strict; use warnings; package My::Spew; use XML::Spew; use base 'XML::Spew'; __PACKAGE__->_tags(qw/Body Foo/); package main; my $spew = My::Spew->_new (); print $spew->Body ($spew->Foo ('Bar'));