WWW::Correios::CEP - Perl extension for extract address from CEP (zip code) number
use WWW::Correios::CEP; my $cepper = WWW::Correios::CEP-new; my $address = $cepper->find( $cep ); print $address->{street}; # neighborhood, location, uf
This module fetches CEP information (Brazilian ZIP codes) directly from the Correios website, Brazil's official post office company.
Creates a new instance of WWW::Correios::CEP. Accepts the following arguments:
timeout
when to give up connecting to the Correios website. Defaults to 30 seconds.
user_agent
User Agent string. Default to "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
post_url
Where to post the query. Defaults to Correios' current location (we hope!)
post_content
What to post in the query. Defaults to Correios' standard options (we hope!)
lwp_options
Extra options to pass to LWP::UserAgent.
Recieves the CEP string and tries to get address data. Returns a hashref with the following keys:
street
neighborhood
location
uf
status
If there is more than one address, it returns a list of hashrefs in list context, or just the first hashref in scalar context, together with an "address_count" key with the total returned addresses.
address_count
WWW::Correios::SRO
You may reports on github:
https://github.com/renatocron/WWW--Correios--CEP/issues
You can find documentation for this module with the perldoc command.
perldoc WWW\:\:Correios\:\:CEP
If you want to contribute with the code, you can fork this module on github:
https://github.com/renatocron/WWW--Correios--CEP
Renato CRON, <rentocron@cpan.org>
2011 - Special thanks to Gabriel "gabiru" Andrade for providing a better solution for finding addresses!
2014 - Thanks to Garu, for removing legacy test code and improving docs!
Copyright (C) 2011-2014 by RenatoCRON
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
See http://dev.perl.org/licenses/ for more information.
To install WWW::Correios::CEP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Correios::CEP
CPAN shell
perl -MCPAN -e shell install WWW::Correios::CEP
For more information on module installation, please visit the detailed CPAN module installation guide.