SYNOPSIS

  use Business::BR::Ids;
  my $cpf = '390.533.447-05';
  print "ok as CPF" if test_id('cpf', $cpf);
  my $cnpj = '90.117.749/7654-80';
  print "ok as CNPJ" if test_id('cnpj', $cnpj);

DESCRIPTION

This is a generic module for handling the various supported operations on Brazilian identification numbers and codes. For example, it is capable to test the correctness of \s-1CPF\s0, \s-1CNPJ\s0 and \s-1IE\s0 numbers without the need for explicitly 'requiring' or 'using' this modules (doing it automatically on demand).

test_id

test_id($entity_type, @args); test_id('cpf', $cpf); # the same as "require Business::BR::CPF; Business::BR::CPF::test_cpf($cpf)" Tests for correct inputs of ids which have a corresponding Business::BR module. For now, the supported id types are 'cpf', 'cnpj', 'ie', and 'pis'.

canon_id

canon_id($entity_type, @args) Transform the input to a canonical form. The canonical form is well-defined and as short as possible. For instance, \*(C`canon_id('cpf', '29.128.129-11')\*(C' returns '02912812911' which has exactly 11 digits and no extra character.

\s-1EXPORT\s0

\*(C`test_id\*(C' is exported by default. \*(C`canon_id\*(C', \*(C`format_id\*(C', \*(C`parse_id\*(C' and \*(C`random_id\*(C' are exported on demand.

RELATED TO Business::BR::Ids…

Details on handling \s-1CPF\s0, \s-1CNPJ\s0, \s-1IE\s0 and \s-1PIS\s0 can be found in the specific modules:

  • Business::BR::CPF

  • Business::BR::CNPJ

  • Business::BR::IE

  • Business::BR::PIS

Please reports bugs via \s-1CPAN\s0 \s-1RT\s0, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids

AUTHOR

A. R. Ferreira, <[email protected]>

COPYRIGHT AND LICENSE

Copyright (C) 2005-2007 by A. R. Ferreira

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.