« blib/lib/WWW/Shopify/Liquid/Filter/DateMath.pm
↑ Summary
blib/lib/WWW/Shopify/Liquid/Filter/Size.pm »
| 1 | #!/usr/bin/perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | package WWW::Shopify::Liquid::Filter::MD5; use base 'WWW::Shopify::Liquid::Filter'; | ||
| 6 | use Digest::MD5 qw(md5_hex); | ||
| 7 | use JSON qw(to_json); | ||
| 8 | sub operate { | ||
| 9 | my ($self, $hash, $operand, @arguments) = @_; | ||
| 10 | $operand = '' unless defined $operand; | ||
| 11 | return md5_hex(to_json($operand, { canonical => 1 })) if ref($operand); | ||
| 12 | return md5_hex($operand); | ||
| 13 | } | ||
| 14 | |||
| 15 | 1; |