Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple asynchronous finger client and server
Perl Perl6
tag: v0.02

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
lib/AnyEvent
t
xt/release
.gitignore
Changes
README.pod
dist.ini

README.pod

NAME

AnyEvent::Finger - Simple asynchronous finger client and server

VERSION

version 0.02

SYNOPSIS

client:

 use AnyEvent::Finger qw( finger_client );
 
 finger_client 'localhost', 'username', sub {
   my($lines) = @_;
   say "[response]";
   say join "\n", @$lines;
 };

server:

 use AnyEvent::Finger qw( finger_server );
 
 my %users = (
   grimlock => 'ME GRIMLOCK HAVE ACCOUNT ON THIS MACHINE',
   optimus  => 'Freedom is the right of all sentient beings.',
 );
 
 finger_server sub {
   my $tx = shift;
   if($tx->req->listing_request)
   {
     # respond if remote requests list of users
     $tx->res->say('users: ', keys %users);
   }
   else
   {
     # respond if user exists
     if(defined $users{$tx->req->username})
     {
       $tx->res->say($users{$request});
     }
     # respond if user does not exist
     else
     {
       $tx->res->say('no such user');
     }
   }
   $tx->res->done;
 };

FUNCTIONS

finger_client( $server, $request, $callback, [ \%options ] )

Send a finger request to the given server. The callback will be called when the response is complete. The options hash may be passed in as the optional forth argument to override any default options (See AnyEvent::Finger::Client for details).

finger_server( $callback, [ \%options ] )

Start listening to finger callbacks and call the given callback for each request. See AnyEvent::Finger::Server for details on the options and the callback.

CAVEATS

Finger is an oldish protocol and almost nobody uses it anymore.

Most finger clients do not have a way to configure an alternate port. Binding to the default port 79 on Unix usually requires root. Running AnyEvent::Finger::Server as root is not recommended.

Under Linux you can use iptables to forward requests to port 79 to an unprivileged port. I was able to use this incantation to forward port 79 to port 8079:

 # iptables -t nat -A PREROUTING -p tcp --dport 79 -j REDIRECT --to-port 8079
 # iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 79 -j REDIRECT --to-port 8079

The first rule is sufficient for external clients, the second rule was required for clients connecting via the loopback interface (localhost).

SEE ALSO

RFC1288, AnyEvent::Finger::Client, AnyEvent::Finger::Server

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 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.

Something went wrong with that request. Please try again.