AnyEvent::Ident::Client - Simple asynchronous ident client
version 0.07
use AnyEvent::Ident::Client; my $client = AnyEvent::Ident::Client->new( hostname => 127.0.0.1' ); $client->ident($server_port, $client_port, sub { my($res) = @_; # isa AnyEvent::Client::Response if($res->is_success) { print "user: ", $res->username, "\n"; print "os: ", $res->os, "\n"; } else { warn "Ident error: " $res->error_type; } });
my $client = AnyEvent::Ident::Client->new(%args);
The constructor takes the following optional arguments:
default 127.0.0.1
The hostname to connect to.
default 113
The port to connect to.
default carp error
A callback subref to be called on error (either connection or transmission error). Passes the error string as the first argument to the callback.
default AnyEvent::Ident::Response
Bless the response object into the given class. This class SHOULD inherit from AnyEvent::Ident::Response, or at least mimic its interface. This allows you to define your own methods for the response class.
$client->ident( $server_port, $client_port, $callback );
Send an ident request to the ident server with the given TCP port pair. The callback will be called when the response is returned from the server. Its only argument will be an instance of AnyEvent::Ident::Response.
On the first call to this method, a connection to the ident server is opened, and will remain open until close (see below) is called, or if the $client object falls out of scope.
close
$client
$client->close;
Close the connection to the ident server. Requests that are in progress will receive an error response with the type UNKNOWN-ERROR.
UNKNOWN-ERROR
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2013 by Graham Ollis.
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 AnyEvent::Ident, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Ident
CPAN shell
perl -MCPAN -e shell install AnyEvent::Ident
For more information on module installation, please visit the detailed CPAN module installation guide.