Busine...BR::Ids(3pm)

πŸ“¦
version 0.0022 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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::CPF
  • Business::BR::CNPJ
  • Business::BR::IE
  • Business::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 (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