File Coverage

blib/lib/WWW/Shopify/Liquid/Operator/Regex.pm
Criterion Covered Total %
statement 16 16 100.0
branch 3 4 75.0
condition 1 3 33.3
subroutine 6 6 100.0
pod 0 3 0.0
total 26 32 81.2


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 21     21   10934 use strict;
  21         33  
  21         720  
3 21     21   125 use warnings;
  21         31  
  21         715  
4              
5             # So sick of crap.
6             package WWW::Shopify::Liquid::Operator::Regex;
7 21     21   85 use base 'WWW::Shopify::Liquid::Operator';
  21         29  
  21         3800  
8 291     291 0 760 sub symbol { return '=~'; }
9 92     92 0 150 sub priority { return 5; }
10             sub operate {
11 14     14 0 22 my ($self, $hash, $action, $op1, $op2) = @_;
12 14 50 33     52 return undef unless defined $op1 && defined $op2;
13 14         98 my @groups = ($op1 =~ m/$op2/);
14 14 100       44 return undef if (int(@groups) == 0);
15 6         21 return \@groups;
16             }
17              
18             1;