File Coverage

blib/lib/WWW/Shopify/Liquid/Dialect/Shopify/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 1     1   10 use strict;
  1         3  
  1         34  
3 1     1   8 use warnings;
  1         3  
  1         46  
4              
5 1     1   7 package WWW::Shopify::Liquid::Dialect::Shopify::Filter::Money; use base 'WWW::Shopify::Liquid::Filter';
  1         2  
  1         297  
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;