line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Money::Converter; |
2
|
1
|
|
|
1
|
|
24547636
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Moose::Role; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
8
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
requires 'convert'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__END__ |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Data::Money::Converter - Moose Role for Data::Money Converters |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 DESCRIPTION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This simple module provides a base for building currency conversion backends |
22
|
|
|
|
|
|
|
for Data::Money. You can use this module either as a basis for understanding |
23
|
|
|
|
|
|
|
the common features or as a guide for implmenting your own converter. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package MyConverter; |
28
|
|
|
|
|
|
|
use Moose; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with 'Data::Money::Converter'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub convert { |
33
|
|
|
|
|
|
|
my ($self, $money, $code) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# convert $money->value to $code and return a new Data::Money object |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 METHODS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This role requires that you implement a C<convert> method. It should expect |
43
|
|
|
|
|
|
|
2 arguments: an isntance of L<Data::Money> and a 3-character currency code. |
44
|
|
|
|
|
|
|
It does not do any checking of the code as not all conversion implementations |
45
|
|
|
|
|
|
|
may support all codes. It is recommended that you consult L<Locale::Currency>. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 AUTHOR |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Cory G Watson, C<< <gphat at cpan.org> >> |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Copyright 2010 Cory G Watson. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
58
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
59
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |