App::Cerberus::Client - A multi-server client for speaking to App::Cerebrus
version 0.08
use App::Cerberus::Client; my $client = App::Cerberus::Client->new( servers => 'http://localhost:5000', ); my $client = App::Cerberus::Client->new( servers => [ 'http://host1:5000', 'http://host2:5000', ], timeout => 0.2 ); my $info = $client->request( ip => '80.1.2.3, ua => 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' );
App::Cerberus::Client is a simple HTTP client for talking to an App::Cerberus server. If more than one server is specified, they will be rotated in round robin fashion, and if any server fails, the next one will be tried until one responds succesfully, or all servers have failed.
$client = App::Cerberus::Client->new( servers => 'http://host1:5000', OR servers => [ 'http://host1:5000', 'http://host2:5000' ], timeout => 0.1, );
The servers params accepts a single server or an array ref of servers. The timeout param is in seconds (defaults to 0.1 seconds). Keep this low as you don't want an overloaded App::Cerberus server to become a bottleneck.
servers
timeout
$info = $client->request(%params);
Sends a request to one of the configured servers, failing over to the next server if there is any error. If all servers fail, it returns an empty hash-ref.
Clinton Gormley <drtech@cpan.org>
This software is copyright (c) 2012 by Clinton Gormley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::Cerberus::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Cerberus::Client
CPAN shell
perl -MCPAN -e shell install App::Cerberus::Client
For more information on module installation, please visit the detailed CPAN module installation guide.