| 1 | package Data::Money::Converter; | ||
| 2 | |||
| 3 | 4 | $Data::Money::Converter::VERSION = '0.07'; | |
| 4 | 4 | $Data::Money::Converter::AUTHORITY = 'cpan:GPHAT'; | |
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Data::Money::Converter - Moo Role for Data::Money Converters. | ||
| 9 | |||
| 10 | =head1 VERSION | ||
| 11 | |||
| 12 | Version 0.07 | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | 4 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 4 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 4 | requires 'convert'; | |
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | This simple module provides a base for building currency conversion backends for | ||
| 24 | L<Data::Money>. You can use this module either as a basis for understanding the | ||
| 25 | common features or as a guide for implementing your own converter. | ||
| 26 | |||
| 27 | =head1 SYNOPSIS | ||
| 28 | |||
| 29 | package MoneyConverter; | ||
| 30 | |||
| 31 | use Moo; | ||
| 32 | use namespace::clean; | ||
| 33 | with 'Data::Money::Converter'; | ||
| 34 | |||
| 35 | sub convert { | ||
| 36 | my ($self, $money, $code) = @_; | ||
| 37 | |||
| 38 | return $money->clone( | ||
| 39 | value => $money->value * 2, | ||
| 40 | code => $code | ||
| 41 | ); | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; | ||
| 45 | |||
| 46 | =head1 METHODS | ||
| 47 | |||
| 48 | This role requires that you implement a C<convert> method. It should expect two | ||
| 49 | arguments: an isntance of L<Data::Money> and a 3-character currency code. It does | ||
| 50 | not do any checking of the code as not all conversion implementations may support | ||
| 51 | all codes. It is recommended that you consult L<Locale::Currency>. | ||
| 52 | |||
| 53 | =head1 AUTHOR | ||
| 54 | |||
| 55 | Cory G Watson, C<< <gphat at cpan.org> >> | ||
| 56 | |||
| 57 | Currently maintained by Mohammad S Anwar (MANWAR) C<< <mohammad.anwar at yahoo.com> >> | ||
| 58 | |||
| 59 | =head1 REPOSITORY | ||
| 60 | |||
| 61 | L<https://github.com/manwar/Data-Money-Converter> | ||
| 62 | |||
| 63 | =head1 SEE ALSO | ||
| 64 | |||
| 65 | L<Data::Money> | ||
| 66 | |||
| 67 | =head1 COPYRIGHT & LICENSE | ||
| 68 | |||
| 69 | Copyright 2010 Cory G Watson. | ||
| 70 | |||
| 71 | This program is free software; you can redistribute it and/or modify it under the | ||
| 72 | terms of either: the GNU General Public License as published by the Free Software | ||
| 73 | Foundation; or the Artistic License. | ||
| 74 | |||
| 75 | See http://dev.perl.org/licenses/ for more information. | ||
| 76 | |||
| 77 | =cut | ||
| 78 | |||
| 79 | 4 | 1; # End of Data::Money::Converter | |