projects
/
MojoFacets.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ffa1a22
)
no warnings for non-numeric
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 15 Apr 2010 18:19:16 +0000
(20:19 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 15 Apr 2010 18:19:16 +0000
(20:19 +0200)
lib/MojoFacets/Data.pm
patch
|
blob
|
history
diff --git
a/lib/MojoFacets/Data.pm
b/lib/MojoFacets/Data.pm
index
0c57201
..
c5a8b8a
100644
(file)
--- 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);
# FIXME - multi-level sort
my $numeric = $self->_is_numeric($order);
+ my $missing = $numeric ? 0 : '';
+ no warnings qw(numeric);
my @sorted = sort {
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;
($v1,$v2) = ($v2,$v1) if $sort eq 'd';
$numeric ? $v1 <=> $v2 : $v1 cmp $v2 ;
} $self->_data_items;