AnyEvent::Ident::Server - Simple asynchronous ident server
version 0.01
use AnyEvent::Ident::Server; my $server = AnyEvent::Ident::Server->new; $server->start(sub { my $tx = shift; if($tx->req->server_port == 400 && $tx->req->client_port == 500) { $tx->reply_with_user('UNIX', 'grimlock'); } else { $tx->reply_with_error('NO-USER'); } });
Provide a simple asynchronous ident server.
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.
Start the Ident server. The given callback will be called on each ident request (there may be multiple ident requests for each connection). The first and only argument passed to the callback is the transaction, an instance of AnyEvent::Ident::Transaction. The most important attribute on the transaction object are res, the response object (itself an instance of AnyEvent::Ident::Transaction with server_port and client_port attributes) and the most important methods on the transaction object are reply_with_user and reply_with_error which reply with a successful and error response respectively.
res
server_port
client_port
reply_with_user
reply_with_error
The bind port. If port is set to zero in the constructor or on start, then an ephemeral port will be used, and you can get the port number here.
Stop the server and unbind to the port.
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.