File Coverage

blib/lib/Finance/Tax/Aruba/Income.pm
Criterion Covered Total %
statement 23 24 95.8
branch 3 4 75.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 35 37 94.5


line stmt bran cond sub pod time code
1             package Finance::Tax::Aruba::Income;
2             our $VERSION = '0.008';
3 4     4   409549 use warnings;
  4         45  
  4         122  
4 4     4   21 use strict;
  4         8  
  4         103  
5              
6             # ABSTRACT: Income tax calculations for Aruba
7              
8 4     4   24 use Carp qw(croak);
  4         7  
  4         214  
9 4     4   24 use List::Util qw(first);
  4         7  
  4         348  
10              
11             use Module::Pluggable
12 4         26 require => 1,
13             sub_name => '_plugins',
14             search_path => 'Finance::Tax::Aruba::Income',
15 4     4   1792 ;
  4         41832  
16              
17             our @years;
18              
19             sub _years {
20 25 100   25   132 return @years if @years;
21 4         21 @years = shift->_plugins;
22 4         6848 return @years;
23             }
24              
25             sub tax_year {
26 25     25 1 93110 my ($self, $year, @args) = @_;
27              
28 25         100 my @years = $self->_years();
29 25     55   320 my $module = first { $_->is_year($year) } @years;
  55         296  
30 25 50       1135 return $module->new(@args) if $module;
31 0           croak("Unable to find module for year $year");
32             }
33              
34             1;
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             Finance::Tax::Aruba::Income - Income tax calculations for Aruba
45              
46             =head1 VERSION
47              
48             version 0.008
49              
50             =head1 SYNOPSIS
51              
52             use Finance::Tax::Aruba::Income;
53              
54             # For all the options, please see
55             # Finance::Tax::Aruba::Role::Income::TaxYear
56             my %opts = (
57             income => 7000
58             );
59              
60             my $calc = Finance::Tax::Aruba::Income->tax_year(2020, %opts);
61              
62             =head1 DESCRIPTION
63              
64             Factory for tax calculations
65              
66             =head1 SUPPORTED YEARS
67              
68             All the years from 2020 up to 2023 are supported.
69              
70             =head1 METHODS
71              
72             =head2 tax_year
73              
74             Factory method to create the correct calculator for a given tax year
75              
76             =head1 SEE ALSO
77              
78             L<Finance::Tax::Aruba::Role::Income::TaxYear>
79              
80             =head1 AUTHOR
81              
82             Wesley Schwengle <waterkip@cpan.org>
83              
84             =head1 COPYRIGHT AND LICENSE
85              
86             This software is Copyright (c) 2020 by Wesley Schwengle.
87              
88             This is free software, licensed under:
89              
90             The (three-clause) BSD License
91              
92             =cut