File Coverage

blib/lib/WWW/Shopify/Liquid/Filter/Money.pm
Criterion Covered Total %
statement 9 15 60.0
branch 0 4 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 24 50.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2 21     21   9908 use strict;
  21         36  
  21         739  
3 21     21   98 use warnings;
  21         36  
  21         676  
4              
5 21     21   93 package WWW::Shopify::Liquid::Filter::Money; use base 'WWW::Shopify::Liquid::Filter';
  21         32  
  21         3581  
6             sub operate {
7 0 0   0 0   return undef unless $_[2];
8 0           my $format = $_[1]->{shop}->{money_format};
9 0 0         $format = '$ {{ amount }' unless $format;
10 0           my $amount = sprintf('%.2f', $_[2] / 100.0);
11 0           $format =~ s/{{\s*amount\s*}}/$amount/;
12 0           return $format;
13             }
14             1;