line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
37
|
|
|
37
|
|
15035
|
use strict; |
|
37
|
|
|
|
|
175
|
|
|
37
|
|
|
|
|
1116
|
|
3
|
37
|
|
|
37
|
|
231
|
use warnings; |
|
37
|
|
|
|
|
99
|
|
|
37
|
|
|
|
|
1404
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package WWW::Shopify::Liquid::Operator::Regex; |
7
|
37
|
|
|
37
|
|
239
|
use base 'WWW::Shopify::Liquid::Operator'; |
|
37
|
|
|
|
|
94
|
|
|
37
|
|
|
|
|
4735
|
|
8
|
1318
|
|
|
1318
|
0
|
3688
|
sub symbol { return '=~'; } |
9
|
510
|
|
|
510
|
0
|
1107
|
sub priority { return 5; } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Ensures that regexes can't be used maliciously. |
12
|
37
|
|
|
37
|
|
275
|
no re 'eval'; |
|
37
|
|
|
|
|
88
|
|
|
37
|
|
|
|
|
2213
|
|
13
|
37
|
|
|
37
|
|
12291
|
use re::engine::RE2 (-strict => 1, -max_mem => (2**24)); |
|
37
|
|
|
|
|
104703
|
|
|
37
|
|
|
|
|
310
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub operate { |
16
|
20
|
|
|
20
|
0
|
57
|
my ($self, $hash, $action, $op1, $op2) = @_; |
17
|
20
|
50
|
33
|
|
|
85
|
return undef unless defined $op1 && defined $op2; |
18
|
20
|
|
|
|
|
861
|
my @groups = ($op1 =~ m/$op2/); |
19
|
20
|
100
|
|
|
|
105
|
return undef if (int(@groups) == 0); |
20
|
11
|
|
|
|
|
52
|
return \@groups; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |