| 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
| |||||||||||
| 27 | |||||||||||
| 28 | 10 | ▶ | if ( ! ref( $args ) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | ||||||||||