NAME

AmberDB::Locale::Currency - ISO 4217 Currency Definition and Symbol Dictionary

SYNOPSIS

use AmberDB::Locale::Currency;

# Symbol and name lookups
my $sym  = AmberDB::Locale::Currency->symbol('TRY'); # '₺'
my $name = AmberDB::Locale::Currency->name('USD');   # 'US Dollar'
my $info = AmberDB::Locale::Currency->by_code('EUR');
# => { num => '978', name => 'Euro', symbol => '€', digits => 2 }

# Dropdown options for UI forms
my @options = AmberDB::Locale::Currency->all();
# => ( [ 'TRY', 'Turkish Lira' ], [ 'USD', 'US Dollar' ], ... )

DESCRIPTION

AmberDB::Locale::Currency provides an immutable dictionary of ISO 4217 currency definitions, numeric codes, currency symbols, and default subunit decimal precision.

METHODS

by_code($iso_code)

Returns the currency definition hash reference for the given 3-letter ISO 4217 code (case-insensitive).

my $curr = AmberDB::Locale::Currency->by_code('GBP');
# Returns: { num => '826', name => 'Pound Sterling', symbol => '£', digits => 2 }

symbol($iso_code)

Returns the currency symbol for the given ISO code (e.g. '₺', '$', '€', '£', '₽', '¥'). If the code is unknown, returns the uppercase code itself.

my $sym = AmberDB::Locale::Currency->symbol('TRY'); # '₺'

name($iso_code)

Returns the English currency name for the given ISO code.

my $name = AmberDB::Locale::Currency->name('USD'); # 'US Dollar'

all()

Returns a list of 2-element array references [ $code, $name ] ordered by priority, suitable for rendering HTML <select> form dropdowns.

my @dropdown_items = AmberDB::Locale::Currency->all();

active_codes()

Returns the list of active 3-letter ISO 4217 currency codes supported by the dictionary (e.g. TRY, USD, EUR, GBP, RUB, AZN, SAR, JPY, CHF, CAD, AUD, CNY).

my @codes = AmberDB::Locale::Currency->active_codes();

AUTHOR

Maruf Cetin <marufcetin@gmail.com>

LICENSE AND COPYRIGHT

Copyright (C) 2026 Maruf Cetin.

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.