From 796df13e49a6ca1be8fb4ce2edc54b325aa5c800 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 15 Apr 2010 20:19:16 +0200 Subject: [PATCH] no warnings for non-numeric --- lib/MojoFacets/Data.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index 0c57201..c5a8b8a 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -213,9 +213,11 @@ sub table { # FIXME - multi-level sort my $numeric = $self->_is_numeric($order); + my $missing = $numeric ? 0 : ''; + no warnings qw(numeric); my @sorted = sort { - my $v1 = exists $a->{$order} ? join('', @{$a->{$order}}) : ''; - my $v2 = exists $b->{$order} ? join('', @{$b->{$order}}) : ''; + my $v1 = exists $a->{$order} ? join('', @{$a->{$order}}) : $missing; + my $v2 = exists $b->{$order} ? join('', @{$b->{$order}}) : $missing; ($v1,$v2) = ($v2,$v1) if $sort eq 'd'; $numeric ? $v1 <=> $v2 : $v1 cmp $v2 ; } $self->_data_items; -- 2.20.1