read initial header order from json files
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 25 May 2010 21:37:26 +0000 (23:37 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 25 May 2010 21:37:26 +0000 (23:37 +0200)
lib/MojoFacets/Data.pm

index bfc1183..51e02f9 100644 (file)
@@ -127,6 +127,16 @@ sub _load_path {
                        if $stats->{$n}->{array} == $stats->{$n}->{count};
        }
 
+       if ( ! @header ) {
+               if ( defined $data->{header} ) {
+                       if ( ref $data->{header} eq 'ARRAY' ) {
+                               @header = @{ $data->{header} };
+                       } else {
+                               warn "header not array ", dump( $data->{header} );
+                       }
+               }
+       }
+
        @header =
                sort { $stats->{$b}->{count} <=> $stats->{$a}->{count} }
                grep { defined $stats->{$_}->{count} } keys %$stats