« blib/lib/WWW/Shopify/Liquid/Filter/ImgTag.pm
↑ Summary
blib/lib/WWW/Shopify/Liquid/Filter/Last.pm »
| 1 | #!/usr/bin/perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package WWW::Shopify::Liquid::Filter::First; use base 'WWW::Shopify::Liquid::Filter'; | ||
| 6 | sub transparent { return 1; } | ||
| 7 | sub operate { | ||
| 8 | my ($self, $hash, $operand, @arguments) = @_; | ||
| 9 | return $operand->[0] if $operand && ref($operand) eq "ARRAY"; | ||
| 10 | return $operand->{first} if $operand && ref($operand) eq "HASH"; | ||
| 11 | return undef; | ||
| 12 | } | ||
| 13 | |||
| 14 | 1; |