package MooseX::Types::Locale::Currency;
use 5.008;
use strict;
use warnings;

our $VERSION = '0.001005'; # VERSION

use MooseX::Types -declare => [ qw( CurrencyCode ) ];
use MooseX::Types::Moose qw( Str Int );
use Module::Runtime 'use_module';

enum CurrencyCode, [
	use_module('Locale::Currency', 3 )
	&& Locale::Currency::all_currency_codes()

coerce CurrencyCode,
	from Int,
	via {
		use_module('Locale::Currency', 3 );
		Locale::Currency::currency_code2code( $_, 'num', 'alpha' );


# ABSTRACT: Moose Types related to Locale Currency



=encoding UTF-8

=head1 NAME

MooseX::Types::Locale::Currency - Moose Types related to Locale Currency

=head1 VERSION

version 0.001005


		package My::Object;
		use Moose;
		use MooseX::Types::Locale::Currency qw( CurrencyCode );

		has currency_code => (
			is => 'ro',
			isa => CurrencyCode,

	my $obj = My::Object->new({
		currency_code => 'usd'


This module provides the C<CurrencyCode> type.

=head1 TYPES


=item * C<CurrencyCode>

Base Type: C<enum>

will validate the the 3 character string passed to it is in the list of

Enabling coercion will allow you to input the ISO 4217 Numeric currency code
and will convert it into the 3 Alpha character currency code.


=head1 SEE ALSO


=item * L<Locale::Currency>


=head1 BUGS

Please report any bugs or feature requests on the bugtracker website

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired

=head1 AUTHOR

Caleb Cushing <>


This software is Copyright (c) 2013 by Caleb Cushing.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)