line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Money::Converter::WebserviceX; |
2
|
1
|
|
|
1
|
|
28195
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
710
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Data::Money; |
7
|
|
|
|
|
|
|
use Data::Money::Types qw(CurrencyCode); |
8
|
|
|
|
|
|
|
use Finance::Currency::Convert::WebserviceX; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Data::Money::Converter'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '_converter' => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Finance::Currency::Convert::WebserviceX', |
17
|
|
|
|
|
|
|
lazy_build => 1 |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _build__converter { |
21
|
|
|
|
|
|
|
return Finance::Currency::Convert::WebserviceX->new; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub convert { |
25
|
|
|
|
|
|
|
my ($self, $curr, $code) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
die("$code is not a valid currency code.") unless is_CurrencyCode($code); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $curr->clone( |
30
|
|
|
|
|
|
|
code => $code, |
31
|
|
|
|
|
|
|
value => $self->_converter->convert($curr->value, $curr->code, $code), |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Data::Money::Converter::WebserviceX - WebserviceX currency conversion implementation |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $curr = Data::Money->new(value => 10, code => 'USD'); |
46
|
|
|
|
|
|
|
my $conv = Data::Money::Converter::WebserviceX->new; |
47
|
|
|
|
|
|
|
$conv->convert($curr, 'GBP'); # Converted! |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Cory G Watson, C<< <gphat at cpan.org> >> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Copyright 2010 Cory G Watson. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
61
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
62
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |