blib/lib/WWW/Shopify/Liquid/Tag/Paginate.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 3 SCAR 17.5
CC
3
Cov
0%
process
12.0
paginate
2.0
BEGIN
2.0
CRAP 5.8
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4  
5 use WWW::Shopify::Liquid::Tag;
6  
7 package WWW::Shopify::Liquid::Tag::Paginate;
8 use base 'WWW::Shopify::Liquid::Tag::Enclosing';
9  
10 sub process {
11 my ($self, $hash, $action, $pipeline) = @_;
12 return '' unless int(@{$self->{arguments}}) > 0;
13 my $result = $self->{arguments}->[0]->$action($pipeline, $hash);
14 my ($string, $argument);
15 if ($result && ref($result) && $result->isa('WWW::Shopify::Liquid::Operator::By')) {
16 my $reference = $pipeline->variable_reference($hash, $result->{operands}->[0], 1);
17 my $amount = $result->{operands}->[1]->$action($pipeline, $hash);
18 $$reference = $self->paginate($hash, $reference, $amount);
19 my $result = $self->{contents}->$action($pipeline, $hash);
20 return $result;
21 } else {
22 return $self;
23 }
24 }
25  
26 sub paginate {
27 my ($self, $hash, $variable_reference, $amount) = @_;
28 return $self;
29 }
30  
31 1;