[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/5.10.0/Locale/ -> Currency.pm (source)

   1  #
   2  # Locale::Currency - ISO three letter codes for currency identification
   3  #                    (ISO 4217)
   4  #
   5  # $Id: Currency.pm,v 2.7 2004/06/10 21:19:34 neilb Exp $
   6  #
   7  
   8  package Locale::Currency;
   9  use strict;
  10  require 5.002;
  11  
  12  require Exporter;
  13  
  14  #-----------------------------------------------------------------------
  15  #    Public Global Variables
  16  #-----------------------------------------------------------------------
  17  use vars qw($VERSION @ISA @EXPORT);
  18  $VERSION      = sprintf("%d.%02d", q$Revision: 2.7 $ =~ /(\d+)\.(\d+)/);
  19  @ISA          = qw(Exporter);
  20  @EXPORT       = qw(&code2currency &currency2code
  21                     &all_currency_codes &all_currency_names );
  22  
  23  #-----------------------------------------------------------------------
  24  #    Private Global Variables
  25  #-----------------------------------------------------------------------
  26  my %CODES      = ();
  27  my %CURRENCIES = ();
  28  
  29  
  30  #=======================================================================
  31  #
  32  # code2currency( CODE )
  33  #
  34  #=======================================================================
  35  sub code2currency
  36  {
  37      my $code = shift;
  38  
  39  
  40      return undef unless defined $code;
  41      $code = lc($code);
  42      if (exists $CODES{$code})
  43      {
  44          return $CODES{$code};
  45      }
  46      else
  47      {
  48          #---------------------------------------------------------------
  49          # no such currency code!
  50          #---------------------------------------------------------------
  51          return undef;
  52      }
  53  }
  54  
  55  
  56  #=======================================================================
  57  #
  58  # currency2code ( CURRENCY )
  59  #
  60  #=======================================================================
  61  sub currency2code
  62  {
  63      my $curr = shift;
  64  
  65  
  66      return undef unless defined $curr;
  67      $curr = lc($curr);
  68      if (exists $CURRENCIES{$curr})
  69      {
  70          return $CURRENCIES{$curr};
  71      }
  72      else
  73      {
  74          #---------------------------------------------------------------
  75          # no such currency!
  76          #---------------------------------------------------------------
  77          return undef;
  78      }
  79  }
  80  
  81  
  82  #=======================================================================
  83  #
  84  # all_currency_codes()
  85  #
  86  #=======================================================================
  87  sub all_currency_codes
  88  {
  89      return keys %CODES;
  90  }
  91  
  92  
  93  #=======================================================================
  94  #
  95  # all_currency_names()
  96  #
  97  #=======================================================================
  98  sub all_currency_names
  99  {
 100      return values %CODES;
 101  }
 102  
 103  
 104  #=======================================================================
 105  # initialisation code - stuff the DATA into the CODES hash
 106  #=======================================================================
 107  {
 108      my    $code;
 109      my    $currency;
 110      local $_;
 111  
 112  
 113      while (<DATA>)
 114      {
 115          next unless /\S/;
 116          chop;
 117          ($code, $currency) = split(/:/, $_, 2);
 118          $CODES{$code} = $currency;
 119          $CURRENCIES{"\L$currency"} = $code;
 120      }
 121  
 122      close(DATA);
 123  }
 124  
 125  1;
 126  
 127  __DATA__
 128  adp:Andorran Peseta
 129  aed:UAE Dirham
 130  afa:Afghani
 131  all:Lek
 132  amd:Armenian Dram
 133  ang:Netherlands Antillean Guilder
 134  aoa:Kwanza
 135  aon:New Kwanza
 136  aor:Kwanza Reajustado
 137  ars:Argentine Peso
 138  ats:Schilling
 139  aud:Australian Dollar
 140  awg:Aruban Guilder
 141  azm:Azerbaijanian Manat
 142  
 143  bam:Convertible Marks
 144  bbd:Barbados Dollar
 145  bdt:Taka
 146  bef:Belgian Franc
 147  bgl:Lev
 148  bgn:Bulgarian Lev
 149  bhd:Bahraini Dinar
 150  bhd:Dinar
 151  bif:Burundi Franc
 152  bmd:Bermudian Dollar
 153  bnd:Brunei Dollar
 154  bob:Boliviano
 155  bov:MVDol
 156  brl:Brazilian Real
 157  bsd:Bahamian Dollar
 158  btn:Ngultrum
 159  bwp:Pula
 160  byb:Belarussian Ruble
 161  byr:Belarussian Ruble
 162  bzd:Belize Dollar
 163  
 164  cad:Canadian Dollar
 165  cdf:Franc Congolais
 166  chf:Swiss Franc
 167  clf:Unidades de Formento
 168  clp:Chilean Peso
 169  cny:Yuan Renminbi
 170  cop:Colombian Peso
 171  crc:Costa Rican Colon
 172  cup:Cuban Peso
 173  cve:Cape Verde Escudo
 174  cyp:Cyprus Pound
 175  czk:Czech Koruna
 176  
 177  dem:German Mark
 178  djf:Djibouti Franc
 179  dkk:Danish Krone
 180  dop:Dominican Peso
 181  dzd:Algerian Dinar
 182  
 183  ecs:Sucre
 184  ecv:Unidad de Valor Constante (UVC)
 185  eek:Kroon
 186  egp:Egyptian Pound
 187  ern:Nakfa
 188  esp:Spanish Peseta
 189  etb:Ethiopian Birr
 190  eur:Euro
 191  
 192  fim:Markka
 193  fjd:Fiji Dollar
 194  fkp:Falkland Islands Pound
 195  frf:French Franc
 196  
 197  gbp:Pound Sterling
 198  gel:Lari
 199  ghc:Cedi
 200  gip:Gibraltar Pound
 201  gmd:Dalasi
 202  gnf:Guinea Franc
 203  grd:Drachma
 204  gtq:Quetzal
 205  gwp:Guinea-Bissau Peso
 206  gyd:Guyana Dollar
 207  
 208  hkd:Hong Kong Dollar
 209  hnl:Lempira
 210  hrk:Kuna
 211  htg:Gourde
 212  huf:Forint
 213  
 214  idr:Rupiah
 215  iep:Irish Pound
 216  ils:Shekel
 217  inr:Indian Rupee
 218  iqd:Iraqi Dinar
 219  irr:Iranian Rial
 220  isk:Iceland Krona
 221  itl:Italian Lira
 222  
 223  jmd:Jamaican Dollar
 224  jod:Jordanian Dinar
 225  jpy:Yen
 226  
 227  kes:Kenyan Shilling
 228  kgs:Som
 229  khr:Riel
 230  kmf:Comoro Franc
 231  kpw:North Korean Won
 232  krw:Won
 233  kwd:Kuwaiti Dinar
 234  kyd:Cayman Islands Dollar
 235  kzt:Tenge
 236  
 237  lak:Kip
 238  lbp:Lebanese Pound
 239  lkr:Sri Lanka Rupee
 240  lrd:Liberian Dollar
 241  lsl:Loti
 242  ltl:Lithuanian Litas
 243  luf:Luxembourg Franc
 244  lvl:Latvian Lats
 245  lyd:Libyan Dinar
 246  
 247  mad:Moroccan Dirham
 248  mdl:Moldovan Leu
 249  mgf:Malagasy Franc
 250  mkd:Denar
 251  mmk:Kyat
 252  mnt:Tugrik
 253  mop:Pataca
 254  mro:Ouguiya
 255  mtl:Maltese Lira
 256  mur:Mauritius Rupee
 257  mvr:Rufiyaa
 258  mwk:Kwacha
 259  mxn:Mexican Nuevo Peso
 260  myr:Malaysian Ringgit
 261  mzm:Metical
 262  
 263  nad:Namibia Dollar
 264  ngn:Naira
 265  nio:Cordoba Oro
 266  nlg:Netherlands Guilder
 267  nok:Norwegian Krone
 268  npr:Nepalese Rupee
 269  nzd:New Zealand Dollar
 270  
 271  omr:Rial Omani
 272  
 273  pab:Balboa
 274  pen:Nuevo Sol
 275  pgk:Kina
 276  php:Philippine Peso
 277  pkr:Pakistan Rupee
 278  pln:Zloty
 279  pte:Portuguese Escudo
 280  pyg:Guarani
 281  
 282  qar:Qatari Rial
 283  
 284  rol:Leu
 285  rub:Russian Ruble
 286  rur:Russian Ruble
 287  rwf:Rwanda Franc
 288  
 289  sar:Saudi Riyal
 290  sbd:Solomon Islands Dollar
 291  scr:Seychelles Rupee
 292  sdd:Sudanese Dinar
 293  sek:Swedish Krona
 294  sgd:Singapore Dollar
 295  shp:St. Helena Pound
 296  sit:Tolar
 297  skk:Slovak Koruna
 298  sll:Leone
 299  sos:Somali Shilling
 300  srg:Surinam Guilder
 301  std:Dobra
 302  svc:El Salvador Colon
 303  syp:Syrian Pound
 304  szl:Lilangeni
 305  
 306  thb:Baht
 307  tjr:Tajik Ruble
 308  tmm:Manat
 309  tnd:Tunisian Dollar
 310  top:Pa'anga
 311  tpe:Timor Escudo
 312  trl:Turkish Lira
 313  ttd:Trinidad and Tobago Dollar
 314  twd:New Taiwan Dollar
 315  tzs:Tanzanian Shilling
 316  
 317  uah:Hryvnia
 318  uak:Karbovanets
 319  ugx:Uganda Shilling
 320  usd:US Dollar
 321  usn:US Dollar (Next day)
 322  uss:US Dollar (Same day)
 323  uyu:Peso Uruguayo
 324  uzs:Uzbekistan Sum
 325  
 326  veb:Bolivar
 327  vnd:Dong
 328  vuv:Vatu
 329  
 330  wst:Tala
 331  
 332  xaf:CFA Franc BEAC
 333  xag:Silver
 334  xau:Gold
 335  xba:European Composite Unit
 336  xbb:European Monetary Unit
 337  xbc:European Unit of Account 9
 338  xb5:European Unit of Account 17
 339  xcd:East Caribbean Dollar
 340  xdr:SDR
 341  xeu:ECU (until 1998-12-31)
 342  xfu:UIC-Franc
 343  xfo:Gold-Franc
 344  xof:CFA Franc BCEAO
 345  xpd:Palladium
 346  xpf:CFP Franc
 347  xpt:Platinum
 348  
 349  yer:Yemeni Rial
 350  yum:New Dinar
 351  
 352  zal:Financial Rand
 353  zar:Rand
 354  zmk:Kwacha
 355  zrn:New Zaire
 356  zwd:Zimbabwe Dollar


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1