« blib/lib/WWW/Shopify/Liquid/Filter/WordWrap.pm
↑ Summary
blib/lib/WWW/Shopify/Liquid/Filter/DateParse.pm »
| 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; |