File Coverage

blib/lib/WWW/BackpackTF/Currency.pm
Criterion Covered Total %
statement 8 26 30.7
branch 0 2 0.0
condition n/a
subroutine 3 15 20.0
pod 11 12 91.6
total 22 55 40.0


line stmt bran cond sub pod time code
1             package WWW::BackpackTF::Currency;
2              
3 2     2   25 use 5.014000;
  2         4  
4 2     2   6 use strict;
  2         2  
  2         28  
5 2     2   6 use warnings;
  2         6  
  2         519  
6             our $VERSION = '0.002001';
7              
8             sub new{
9 0     0 0   my ($class, $name, $content) = @_;
10 0           $content->{name} = $name;
11 0           bless $content, $class
12             }
13              
14 0     0 1   sub name { shift->{name} }
15 0     0 1   sub quality { shift->{quality} }
16 0     0 1   sub priceindex { shift->{priceindex}}
17 0     0 1   sub single { shift->{single} }
18 0     0 1   sub plural { shift->{plural} }
19 0     0 1   sub round { shift->{round} }
20 0     0 1   sub craftable { shift->{craftable} eq 'Craftable' }
21 0     0 1   sub tradable { shift->{tradable} eq 'Tradable' }
22 0     0 1   sub defindex { shift->{defindex} }
23              
24 0     0 1   sub quality_name { WWW::BackpackTF::QUALITIES->[shift->{quality}] }
25             sub stringify {
26 0     0 1   my ($self, $nr) = @_;
27 0           my $round = $self->round;
28 0           $nr = sprintf "%.${round}f", $nr;
29 0 0         my $suf = $nr == 1 ? $self->single : $self->plural;
30 0           "$nr $suf";
31             }
32              
33             1;
34             __END__