Busine...BR::Ids(3pm)
π NAME π
Business::BR::Ids β literally the module for dealing with Brazilian identification codes (CPF, CNPJ, ...) π
okay bestie, if you've ever had to vibe-check a Brazilian ID number and been like "is this even real π", this is the module for you.
β¨ 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);
look at that. two lines and you're already validating national documents. main character energy fr fr π
π¦ DESCRIPTION π¦
So this is the generic module, right β the one that handles all the various supported operations on Brazilian identification numbers and codes. It's giving "one module to rule them all" π
Like, it's capable to test the correctness of CPF, CNPJ and IE numbers without you needing to explicitly require or use those modules β it does it automatically on demand. no cap. it just handles it. periodt. π
πΈ test_id
test_id($entity_type, @args);
test_id('cpf', $cpf); # the same as "require Business::BR::CPF; Business::BR::CPF::test_cpf($cpf)"
This one tests for correct inputs of ids that have a corresponding Business::BR module. β¨ For now, the supported id types are 'cpf', 'cnpj', 'ie', and 'pis'. That's the whole roster, bestie β know your four icons.
π canon_id
canon_id($entity_type, @args)
This one transforms the input into a canonical form. The canonical form is well-defined and as short as possible. Like, minimalism but make it data. π§
For instance, canon_id('cpf', '29.128.129-11') returns '02912812911' β which has exactly 11 digits and no extra character. obsessed. no dots, no dash, no nonsense, just digits. π
π EXPORT π
test_id is exported by default (she comes free with the module, generous queen π).
canon_id, format_id, parse_id and random_id are exported on demand β you gotta ask for those ones, they're the exclusive VIPs. π
β SEE ALSO β
Details on handling CPF, CNPJ, IE and PIS can be found in the specific modules:
Business::BR::CPFBusiness::BR::CNPJBusiness::BR::IEBusiness::BR::PIS
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids
lowkey if something's broken, tell the RT about it β that's the group chat for bugs π
π AUTHOR π
A. R. Ferreira, <ferreira@cpan.org>
πΈ 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.
and that's the whole page, bestie π«Ά this was shipped with perl v5.36.0 and dated 2022-10-13. go validate some documents, you absolute icon πβ¨
π¦ where this page comes from
- ubuntu noble: libbusiness-br-ids-perl 0.0022-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbusiness-br-ids-perl 0.0022-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbusiness-br-ids-perl 0.0022-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms