Preserve groupinglist order when argument is passed
Tara L Andrews [Thu, 23 Aug 2012 19:24:00 +0000 (21:24 +0200)]
lib/Text/Tradition/Analysis/Result.pm
t/data/analysis.db

index 8bd41f2..23db4d9 100644 (file)
@@ -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 {
index f000bdc..aed7aae 100644 (file)
Binary files a/t/data/analysis.db and b/t/data/analysis.db differ