NAME

Business::BR::IE - Perl module to test for correct IE numbers

SYNOPSIS

use Business::BR::IE qw(test_ie flatten_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

DESCRIPTION

YET TO COME. Handles IE for the states of Acre (AC), Sao Paulo (SP) and Paraná (PR) by now.

EXPORT

test_ie is exported by default. flatten_ie, format_ie, random_ie and parse_ie can be exported on demand.

DETAILS

Each state has its own rules for IE numbers. In this section, we gloss over each one of these

AC

The state of Acre uses:

  • 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 or
    		                                                    = 1 (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 or
    		                                                   = 1 (if d_2 = 0)

PR

The state of Paraná uses:

* 10-digits number
* the 9th and 10th are check digits
* the usual formatting is like C<'123.45678-50'>

SP

The state of São Paulo uses:

* 12-digits number
* the 9th and 12nd are check digits
* the usual formatting is like C<'110.042.490.114'>

BUGS

  • This documentation is faulty

  • If you want handling more than AC, SP and PR, you'll have to wait for the next releases

  • The handling of IE-SP does not include yet the special rule for testing correctness of registrations of rural producers.

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.

AUTHOR

A. R. Ferreira, <ferreira@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by A. R. Ferreira

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 308:

Non-ASCII character seen before =encoding in 'Paraná'. Assuming CP1252

Around line 310:

=back without =over