File Coverage

blib/lib/Finance/Tax/Aruba/Income.pm
Criterion Covered Total %
statement 24 25 96.0
branch 3 4 75.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 36 38 94.7


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