File Coverage

blib/lib/AnyEvent/Ident.pm
Criterion Covered Total %
statement 21 21 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package AnyEvent::Ident;
2              
3 1     1   18439 use strict;
  1         2  
  1         32  
4 1     1   3 use warnings;
  1         1  
  1         20  
5 1     1   3 use Exporter ();
  1         1  
  1         152  
6              
7             our @ISA = qw( Exporter );
8             our @EXPORT_OK = qw( ident_server ident_client );
9              
10             # ABSTRACT: Simple asynchronous ident client and server
11             our $VERSION = '0.07'; # VERSION
12              
13              
14             # keep the server object in scope so that
15             # we don't unbind from the port. If you
16             # don't want this, then use the OO interface
17             # for ::Server instead.
18             my $keep = [];
19              
20             sub ident_server ($$$;$)
21             {
22 1     1 1 4509 my $hostname = shift;
23 1         2 my $port = shift;
24 1         2 my $cb = shift;
25 1         542 require AnyEvent::Ident::Server;
26 1 50       8 my $server = AnyEvent::Ident::Server
27 1         3 ->new( hostname => $hostname, port => $port, %{ $_[0] || {} } )
28             ->start($cb);
29 1         2 push @$keep, $server;
30 1         1 return $server;
31             }
32              
33              
34             sub ident_client ($$$$$)
35             {
36 3     3 1 1407 my $hostname = shift;
37 3         3 my $port = shift;
38 3         391 require AnyEvent::Ident::Client;
39 3         14 AnyEvent::Ident::Client
40             ->new( hostname => $hostname, port => $port )
41             ->ident(@_);
42             }
43              
44              
45             1;
46              
47             __END__