Business::BR::IE(3pm)
β¨ NAME β¨
Business::BR::IE β a Perl module to test for correct IE numbers. That's the whole assignment, bestie, and it ate. π
π SYNOPSIS π
use Business::BR::IE qw(test_ie canon_ie format_ie random_ie);
test_ie('sp', '110.042.490.114') # 1
test_ie('pr', '123.45678-50') # 1
test_ie('ac', '01.004.823/001-12') # 1
test_ie('al', '24.000.004-8') # 1
test_ie('am', '04.117.161-6') # 1
test_ie('ba', '123456-63') # 1
test_ie('ma', '12.000.038-5') # 1
test_ie('mg', '062.307.904/0081') #1
test_ie('rr', '24.006.628-1') # 1
test_ie('ap', '03.012.345-9') # 1
okay so the vibe is: you pull in the functions, you hand test_ie a state code plus a number, and a cute little 1 comes back meaning it checks out. no notes. β¨
π¦ DESCRIPTION π¦
YET TO COME. Handles IE for the states of Acre (AC), Alagoas (AL), AmapΓ‘ (AP), Amazonas (AM), Bahia (BA), MaranhΓ£o (MA), Minas Gerais (MG), ParanΓ‘ (PR), RondΓ΄nia (RO), Roraima (RR) and Sao Paulo (SP) by now.
not the description being literally "YET TO COME" π we're keeping it exactly as it is because the facts do not move. What we can tell you: right now it handles IE for Acre (AC), Alagoas (AL), AmapΓ‘ (AP), Amazonas (AM), Bahia (BA), MaranhΓ£o (MA), Minas Gerais (MG), ParanΓ‘ (PR), RondΓ΄nia (RO), Roraima (RR) and Sao Paulo (SP).
π EXPORT π
test_ieβ this one is exported by default, it just shows up, no invite needed πcanon_ie,format_ie,random_ieandparse_ieβ these can be exported on demand, so you gotta ask nicely
π DETAILS π
Every state has its own rules for IE numbers, like every state has its own whole personality fr fr. In this section we gloss over each and every one of them, no skipping, no summarising, we're doing the homework. π
π AC
The state of Acre uses:
- a 13-digits number
- the last two are check digits
- the usual formatting is like
'01.004.823/001-12' - if the IE-AC number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 d_1 d_2
it is correct if
a_1 a_2 = 0 1
(that is, it always begin with "01") and if it satisfies the check equations:
4 a_1 + 3 a_2 + 2 a_3 + 9 a_4 + 8 a_5 + 7 a_6 + 6 a_7 +
5 a_8 + 4 a_9 + 3 a_10 + 2 a_11 + d_1 = 0 (mod 11) or
= 1 (mod 11) (if d_1 = 0)
5 a_1 + 4 a_2 + 3 a_3 + 2 a_4 + 9 a_5 + 8 a_6 + 7 a_7 +
6 a_8 + 5 a_9 + 4 a_10 + 3 a_11 + 2 d_1 + d_2 = 0 (mod 11) or
= 1 (mod 11) (if d_2 = 0)
πΈ AL
The state of Alagoas uses:
- a 9-digits number
- the last one is a check digit
- the usual formatting is like
'24.000.004-8' - if the IE-AL number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
it is correct if it always begin with "24" (the code for the state of Alagoas),
a_1 a_2 = 2 4
if the following digit identifies a valid company type
0- "normal"1- "normal"3- "produtor rural"5- "substituta"6- "empresa pequeno porte"7- "micro empresa ambulante"8- "micro empresa"9- "especial"
and if it satisfies the check equation:
( 9 a_1 + 2 a_2 + 3 a_3 + 4 a_4 + 5 a_5
6 a_6 + 7 a_7 + 8 a_8 ) * 10 - d_1 = 0 (mod 11) or
= 10 (mod 11) (if d_1 = 0)
π AM
The state of Amazonas uses:
- a 9-digits number
- the last one is a check digit
- the usual formatting is like
'11.111.111-0' - if the IE-AM number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
it is correct if it satisfies the check equation:
9 a_1 + 8 a_2 + 7 a_3 + 6 a_4 + 5 a_5
4 a_6 + 3 a_7 + 2 a_8 + d_1 = 0 (mod 11) or
= 1 (mod 11) (if d_1 = 0)
π§ BA
The state of Bahia uses:
- an 8-digits number
- the last two are check digits
- the usual formatting is like
'123456-63'
π MA
The state of MaranhΓ£o uses:
- a 9-digits number
- the 9th is a check digit
- the usual formatting is like
'12.000.038-5' - if the IE-MA number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
it is correct if it always begin with "12" (the code for the state of MaranhΓ£o),
a_1 a_2 = 1 2
and if it satisfies the check equation:
( 9 a_1 + 8 a_2 + 7 a_3 + 6 a_4 + 5 a_5
4 a_6 + 3 a_7 + 2 a_8 ) - d_1 = 0 (mod 11) or
= 10 (mod 11) (if d_1 = 0)
π¦ MG
The state of Minas Gerais uses:
- a 13-digits number
- the 11th and 12th are check digits
- the usual formatting is like
'062.307.904/0081' - to determine if IE/MG number is correct, the computation rules in
http://www.sintegra.gov.br/Cad_Estados/cad_MG.html
must be followed. (Yes, they are boring and hard to describe.)
π₯ PR
The state of ParanΓ‘ uses:
- a 10-digits number
- the 9th and 10th are check digits
- the usual formatting is like
'123.45678-50'
π RO
The state of RondΓ΄nia uses:
- a 14-digits number
- the 14th is a check digit
- the usual formatting is like
'0000000062521-3' - if the IE-RO number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 a_9 a_10 a_11 a_12 a_13 d_1
it is correct if it satisfies the check equation:
( 6 a_1 + 5 a_2 + 4 a_3 + 3 a_4 + 2 a_5 +
9 a_6 + 8 a_7 + 7 a_8 + 6 a_9 + 5 a_10 +
4 a_11 + 3 a_12 + 2 a_13 + d_1 = 0 (mod 11) or
= 1 (mod 11) if d_1 = 0
π RR
The state of Roraima uses:
- a 9-digits number
- the 9th is a check digit
- the usual formatting is like
'24.006.628-1' - if the IE-RR number is decomposed into digits like this
a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8 d_1
it is correct if it always begin with "24" (the code for the state of Roraima),
a_1 a_2 = 2 4
and if it satisfies the check equation:
( 1 a_1 + 2 a_2 + 3 a_3 + 4 a_4 + 5 a_5
6 a_6 + 7 a_7 + 8 a_8 ) - d_1 = 0 (mod 9)
π SP
The state of SΓ£o Paulo uses:
- a 12-digits number
- the 9th and 12nd are check digits
- the usual formatting is like
'110.042.490.114'
π BUGS π
- This documentation is faulty
- If you want handling more than AC, AL, AM, MA, MG, PR, RO, RO and SP, you'll have to wait for the next releases
yes bestie, that list says RO twice and skips RR β we are reporting the bug note as written, not editing it, that is literally the assignment π
- The handling of IE-SP does not include yet the special rule for testing correctness of registrations of rural producers.
- the case of unfair digits must be handled satisfactorily (in this and other
Business::BR::Idsmodules)
π SEE ALSO π
Please reports bugs via CPAN RT, http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-BR-Ids By doing so, the author will receive your reports and patches, as well as the problem and solutions will be documented.
(girlies, that's the entire SEE ALSO section, we don't make the rules, we just render them π«Ά)
π 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.
π POD ERRORS π
Hey! The above document had some coding errors, which are explained below:
Around line 936:
Non-ASCII character seen before =encoding in 'AmapΓ‘'. Assuming
CP1252
and that's the whole page, periodt. this manual came from the perl v5.36.0 release, dated 2022-10-13, and it's officially known as Business::BR::IE(3pm). mwah, go test some IE numbers ππβ¨
π¦ 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