Catmandu-XML

 view release on metacpan or  search on metacpan

t/exporter.t  view on Meta::CPAN

use File::Temp qw(tempdir);
my $dir = tempdir();

$exporter = Catmandu::Exporter::XML->new( directory => $dir, field => '_xml' );
$exporter->add_many([
    { _id => 'foo', _xml => [ foo => {} ] },
    { _id => 'bar.xml', _xml => [ bar => {} ] },
]);
ok(-e "$dir/foo.xml" and -e "$dir/bar.xml", 'export to directory');
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo/>\n";
$out = do { local (@ARGV, $/) = "$dir/foo.xml"; <> };
is $out, $xml, 'exported to multiple files';

done_testing;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.463 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )