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.012';
3 7     7   855153 use warnings;
  7         29  
  7         524  
4 7     7   64 use strict;
  7         16  
  7         275  
5              
6             # ABSTRACT: Income tax calculations for Aruba
7              
8 7     7   37 use Carp qw(croak);
  7         15  
  7         471  
9 7     7   68 use List::Util qw(first);
  7         18  
  7         678  
10              
11             use Module::Pluggable
12 7         53 require => 1,
13             sub_name => '_plugins',
14             search_path => 'Finance::Tax::Aruba::Income',
15 7     7   3965 ;
  7         89958  
16              
17             our @years;
18              
19             sub _years {
20 43 100   43   385 return @years if @years;
21 6         46 @years = shift->_plugins;
22 6         13867 return @years;
23             }
24              
25             sub tax_year {
26 43     43 1 2209626 my $self = shift;
27 43         130 my $year = shift;
28              
29 43         204 my @years = $self->_years();
30 43     118   505 my $module = first { $_->is_year($year) } @years;
  118         1064  
31 43 50       2894 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.012
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