Business-BR-CEP

 view release on metacpan or  search on metacpan

lib/Business/BR/CEP.pm  view on Meta::CPAN


There's some extra benefit to using this module, as it is also able to check
the type and region of the CEP, making it ideal for extra validation.

These functions are B<not> exported by default.

=head2 cep_type( $cep )

=head2 tipo_cep( $cep )

Returns a string containing the type of the CEP, or an empty string if it's not a valid CEP.

Possible return values, depending on the given suffix:

=over 4

=item * C<'logradouro'> - regular addresses (usually that's all you care about):  000-899

=item * C<'especial'> - special codes from the post office: 900-959

=item * C<'promocionais'> - promotional CEP numbers: 960-969

=item * C<'correios'> - Correios facilities: 970-989, 999

=item * C<'caixapostal'> - Community PO Boxes: 990-998

=back

=head2 cep_region( $cep )

=head2 regiao_cep( $cep )

CEP numbers follow this numbering scheme:

   NNNNN-NNN
   ||||| |||
   ||||| || \__
   ||||| | \___\ distribution identifiers (suffix)
   |||||  \____/
   |||||
   |||| \__ subsector division
   ||| \___ subsector
   || \____ sector
   | \_____ subregion
    \______ region

While returning every possible address would require the full Correios database,
the basic regions (first digit) are well known and simple enough to be used, if
only to identify whether the CEP is from the same region as an address.

This function returns an array where each element is the short version of
a Brasilian State covered by the region from the provided CEP, or an empty list
if it's not a valid CEP.


=head1 CONFIGURATION AND ENVIRONMENT

Business::BR::CEP requires no configuration files or environment variables.


=head1 BUGS AND LIMITATIONS

Please report any bugs or feature requests to
C<bug-business-br-cep@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.


=head1 AUTHOR

Breno G. de Oliveira  C<< <garu@cpan.org> >>


=head1 LICENCE AND COPYRIGHT

Copyright (c) 2012, Estante Virtual. All rights reserved.

This module is free software; you can redistribute it and/or
modify it under the same terms as the Perl 5 programming language itself.
See L<perlartistic>.


=head1 DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.



( run in 3.432 seconds using v1.01-cache-2.11-cpan-4ab04211f4c )