Monzo/Currency.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 93.7% 30 / 32 CC 3 SCAR 5.8
CC
3
Cov
92%
__ANON__
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Monzo/Account.pm ↑ Summary Monzo.pm »
1 package Business::Monzo::Currency;
2  
3 =head1 NAME
4  
5 Business::Monzo::Currency
6  
7 =head1 DESCRIPTION
8  
9 A role containing currency attributes / methods
10  
11 =cut
12  
13 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 11 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 11 ▶use Types::Standard qw/ :all /;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 11 ▶use Data::Currency;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 has [ qw/ currency local_currency / ] => (
21 is => 'ro',
22 isa => Maybe[InstanceOf['Data::Currency']],
23 10 ▶ coerce => sub {
Subroutine __ANON__: called CC=3 SCAR=11.3
24 10 my ( $args ) = @_;
25  
26 10 ▶ return undef if ! $args;
Branch: 1 branch
BranchTrueFalseTotal
unless $args 0 10 10
27  
28 10 ▶ if ( ! ref( $args ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args) 10 0 10
29  
30 10 $args = Data::Currency->new({
31 code => $args,
32 });
33 }
34  
35 10 return $args;
36 },
37 11 );
38  
39 =head1 AUTHOR
40  
41 Lee Johnson - C<leejo@cpan.org>
42  
43 This library is free software; you can redistribute it and/or modify it under
44 the same terms as Perl itself. If you would like to contribute documentation,
45 features, bug fixes, or anything else then please raise an issue / pull request:
46  
47 https://github.com/leejo/business-monzo
48  
49 =cut
50  
51 11 1;
52  
53 # vim: ts=4:sw=4:et
« Monzo/Account.pm ↑ Summary Monzo.pm »