line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
37
|
|
|
37
|
|
14968
|
use strict; |
|
37
|
|
|
|
|
114
|
|
|
37
|
|
|
|
|
1125
|
|
3
|
37
|
|
|
37
|
|
252
|
use warnings; |
|
37
|
|
|
|
|
99
|
|
|
37
|
|
|
|
|
1432
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package WWW::Shopify::Liquid::Filter::DateMath; |
6
|
37
|
|
|
37
|
|
256
|
use base 'WWW::Shopify::Liquid::Filter'; |
|
37
|
|
|
|
|
97
|
|
|
37
|
|
|
|
|
10431
|
|
7
|
|
|
|
|
|
|
# +-, #, <unit> |
8
|
6
|
|
|
6
|
0
|
52
|
sub min_arguments { return 2; } |
9
|
9
|
|
|
9
|
0
|
55
|
sub max_arguments { return 2; } |
10
|
|
|
|
|
|
|
sub operate { |
11
|
4
|
|
|
4
|
0
|
18
|
my ($self, $hash, $operand, @arguments) = @_; |
12
|
4
|
|
|
|
|
19
|
my ($number, $unit) = @arguments; |
13
|
4
|
|
|
|
|
15
|
$unit = lc($unit); |
14
|
4
|
50
|
33
|
|
|
32
|
return undef unless ref($operand) && ref($operand) eq "DateTime"; |
15
|
4
|
50
|
|
|
|
35
|
return $operand unless $unit =~ m/^(days|months|years|weeks|seconds|minutes|hours)$/; |
16
|
4
|
|
|
|
|
31
|
return $operand->clone->add( |
17
|
|
|
|
|
|
|
$unit => $number |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |