-
Notifications
You must be signed in to change notification settings - Fork 2
/
Currency.pm
53 lines (34 loc) · 972 Bytes
/
Currency.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package Business::Mondo::Currency;
=head1 NAME
Business::Mondo::Currency
=head1 DESCRIPTION
A role containing currency attributes / methods
=cut
use strict;
use warnings;
use Moo::Role;
use Types::Standard qw/ :all /;
use Data::Currency;
has [ qw/ currency local_currency / ] => (
is => 'ro',
isa => Maybe[InstanceOf['Data::Currency']],
coerce => sub {
my ( $args ) = @_;
return undef if ! $args;
if ( ! ref( $args ) ) {
$args = Data::Currency->new({
code => $args,
});
}
return $args;
},
);
=head1 AUTHOR
Lee Johnson - C<leejo@cpan.org>
This library is free software; you can redistribute it and/or modify it under
the same terms as Perl itself. If you would like to contribute documentation,
features, bug fixes, or anything else then please raise an issue / pull request:
https://github.com/leejo/business-mondo
=cut
1;
# vim: ts=4:sw=4:et