line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
37
|
|
|
37
|
|
14364
|
use strict; |
|
37
|
|
|
|
|
112
|
|
|
37
|
|
|
|
|
1219
|
|
3
|
37
|
|
|
37
|
|
234
|
use warnings; |
|
37
|
|
|
|
|
98
|
|
|
37
|
|
|
|
|
1460
|
|
4
|
|
|
|
|
|
|
|
5
|
37
|
|
|
37
|
|
244
|
package WWW::Shopify::Liquid::Filter::Sort; use base 'WWW::Shopify::Liquid::Filter'; |
|
37
|
|
|
|
|
98
|
|
|
37
|
|
|
|
|
3709
|
|
6
|
37
|
|
|
37
|
|
283
|
use Scalar::Util qw(looks_like_number); |
|
37
|
|
|
|
|
113
|
|
|
37
|
|
|
|
|
7520
|
|
7
|
|
|
|
|
|
|
sub operate { |
8
|
1
|
|
|
1
|
0
|
18
|
my $prop = $_[3]; |
9
|
1
|
50
|
33
|
|
|
12
|
return [] unless ref($_[2]) && ref($_[2]) eq 'ARRAY'; |
10
|
1
|
50
|
|
|
|
6
|
return [sort(@{$_[2]})] if !$prop; |
|
1
|
|
|
|
|
129
|
|
11
|
|
|
|
|
|
|
return [sort { |
12
|
0
|
0
|
0
|
|
|
|
defined $a->{$prop} && looks_like_number($a->{$prop}) && defined $b->{$prop} && looks_like_number($b->{$prop}) ? $a->{$prop} <=> $b->{$prop} : $a->{$prop} cmp $b->{$prop}; |
13
|
0
|
0
|
|
|
|
|
} @{$_[2]}] if $prop; |
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |