From: Dobrica Pavlinusic Date: Tue, 25 May 2010 21:37:26 +0000 (+0200) Subject: read initial header order from json files X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;ds=sidebyside;h=98e3babff4707bcb1f3c98ecd3afa626c33e180b;p=MojoFacets.git read initial header order from json files --- diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index bfc1183..51e02f9 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -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