use lib 't'; BEGIN { # to handle systems with no installed Test module # we include the t dir (where a copy of Test.pm is located) # as a fallback eval { require Test; }; use Test; plan tests => 1; } use Data::Stag; use FileHandle; my $moviedata = getmoviedata(); my ($hdr, @data) = process($moviedata); # by director my $dirstruct = Data::Stag->normalize(-top=>"director-set", -rows=>\@data, -cols=>$hdr, -path=>"(director(film(actor(character 1))))"); print $dirstruct->xml; my $ss = <normalize($ss, \@data); print $mstruct->xml; ($hdr, @data) = process(getanimaldata()); my $struct = Data::Stag->normalize(-top=>"animal-set", -rows=>\@data, -cols=>$hdr, -path=>"'(rel 1)"); print $struct->xml; ok(1); exit 0; # sub process{ my $data = shift; my @data = map {chomp;[split(/\,\s*/, $_)]} split(/\n/,$data); # first line is header line my $hdr = shift @data; $hdr->[0] =~ s/^\#//; return ($hdr, @data); } sub getmoviedata { return <