From: Tara L Andrews Date: Thu, 23 Aug 2012 19:24:00 +0000 (+0200) Subject: Preserve groupinglist order when argument is passed X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b42d71139c96fa45fa01640da9841083e9468800;p=scpubgit%2Fstemmatology.git Preserve groupinglist order when argument is passed --- diff --git a/lib/Text/Tradition/Analysis/Result.pm b/lib/Text/Tradition/Analysis/Result.pm index 8bd41f2..23db4d9 100644 --- a/lib/Text/Tradition/Analysis/Result.pm +++ b/lib/Text/Tradition/Analysis/Result.pm @@ -108,8 +108,9 @@ around BUILDARGS => sub { die "Must specify a set list to Analysis::Result->new()" unless ref( $args->{'setlist'} ) eq 'ARRAY'; # Order the sets and make sure they are all distinct Set::Scalars. - $args->{'setlist'} = _check_set_args( $args->{'setlist'} ); - $args->{'groupinglist'} = _check_set_args( $args->{'groupinglist'} ); + $args->{'setlist'} = [ sort { by_size_and_alpha( $a, $b ) } + _check_set_args( $args->{'setlist'} ) ]; + $args->{'groupinglist'} = [ _check_set_args( $args->{'groupinglist'} ) ]; # If we have been passed a Text::Tradition::Stemma or a Graph, save only # its string. @@ -148,7 +149,7 @@ sub _check_set_args { # Save the set. push( @sets, $s ); } - return [ sort { by_size_and_alpha( $a, $b ) } @sets ]; + return @sets; } sub BUILD { diff --git a/t/data/analysis.db b/t/data/analysis.db index f000bdc..aed7aae 100644 Binary files a/t/data/analysis.db and b/t/data/analysis.db differ