line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
37
|
|
|
37
|
|
16005
|
use strict; |
|
37
|
|
|
|
|
113
|
|
|
37
|
|
|
|
|
1187
|
|
3
|
37
|
|
|
37
|
|
240
|
use warnings; |
|
37
|
|
|
|
|
101
|
|
|
37
|
|
|
|
|
1455
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package WWW::Shopify::Liquid::Tag::Increment; |
6
|
37
|
|
|
37
|
|
244
|
use base 'WWW::Shopify::Liquid::Tag::Free'; |
|
37
|
|
|
|
|
93
|
|
|
37
|
|
|
|
|
7621
|
|
7
|
0
|
|
|
0
|
0
|
0
|
sub max_arguments { return 1; } |
8
|
0
|
|
|
0
|
0
|
0
|
sub min_arguments { return 1; } |
9
|
|
|
|
|
|
|
sub verify { |
10
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
11
|
|
|
|
|
|
|
die new WWW::Shopify::Liquid::Exception::Parser::Arguments($self, "Requires variable to increment.") unless |
12
|
1
|
50
|
|
|
|
15
|
$self->{arguments}->[0]->isa('WWW::Shopify::Liquid::Token::Variable'); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
37
|
|
|
37
|
|
394
|
use Scalar::Util qw(looks_like_number); |
|
37
|
|
|
|
|
104
|
|
|
37
|
|
|
|
|
12594
|
|
16
|
|
|
|
|
|
|
sub process { |
17
|
1
|
|
|
1
|
0
|
4
|
my ($self, $hash, $action, $pipeline) = @_; |
18
|
1
|
50
|
|
|
|
3
|
my @vars = map { $self->is_processed($_) ? $_ : $_->$action($pipeline, $hash) } @{$self->{arguments}->[0]->{core}}; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
3
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
3
|
my $inner_hash = $hash; |
21
|
1
|
|
|
|
|
4
|
for (0..$#vars-1) { |
22
|
0
|
0
|
0
|
|
|
0
|
return $self if ref($inner_hash) && ref($inner_hash) eq "HASH" && !exists $inner_hash->{$vars[$_]} && $action eq 'optimize'; |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
23
|
0
|
0
|
0
|
|
|
0
|
if (looks_like_number($vars[$_]) && ref($inner_hash) && ref($inner_hash) eq "ARRAY") { |
|
|
|
0
|
|
|
|
|
24
|
0
|
0
|
|
|
|
0
|
$inner_hash->[$vars[$_]] = {} if !defined $inner_hash->[$vars[$_]]; |
25
|
0
|
|
|
|
|
0
|
$inner_hash = $inner_hash->[$vars[$_]]; |
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
0
|
|
|
|
0
|
$inner_hash->{$vars[$_]} = {} if !exists $inner_hash->{$vars[$_]}; |
28
|
0
|
|
|
|
|
0
|
$inner_hash = $inner_hash->{$vars[$_]}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
1
|
50
|
33
|
|
|
9
|
if (exists $inner_hash->{$vars[-1]} && looks_like_number($inner_hash->{$vars[-1]})) { |
32
|
1
|
|
|
|
|
5
|
$inner_hash->{$vars[-1]}++; |
33
|
|
|
|
|
|
|
} |
34
|
1
|
|
|
|
|
5
|
return ''; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |