NAME

AnyEvent::Ident::Client - Simple asynchronous ident client

VERSION

version 0.01

SYNOPSIS

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)
  {
    say "user: ", $res->username;
    say "os:   ", $res->os;
  }
  else
  {
    warn "Ident error: " $res->error_type;
  }
});

CONSTRUCTOR

The constructor takes the following optional arguments:

  • hostname (default 127.0.0.1)

    The hostname to connect to.

  • port (default 113)

    The port to connect to.

  • on_error (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.

METHODS

$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.

$client->close

Close the connection to the ident server. Requests that are in progress will receive an error response with the type UNKNOWN-ERROR.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

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.