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 2     2   71062 use strict;
  2         4  
  2         73  
4 2     2   12 use warnings;
  2         4  
  2         61  
5 2     2   10 use Exporter ();
  2         4  
  2         468  
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.06'; # 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 6292 my $hostname = shift;
23 1         25 my $port = shift;
24 1         3 my $cb = shift;
25 1         1393 require AnyEvent::Ident::Server;
26 1 50       19 my $server = AnyEvent::Ident::Server
27 1         7 ->new( hostname => $hostname, port => $port, %{ $_[0] || {} } )
28             ->start($cb);
29 1         6 push @$keep, $server;
30 1         4 return $server;
31             }
32              
33              
34             sub ident_client
35             {
36 3     3 1 7017 my $hostname = shift;
37 3         9 my $port = shift;
38 3         2355 require AnyEvent::Ident::Client;
39 3         41 AnyEvent::Ident::Client
40             ->new( hostname => $hostname, port => $port )
41             ->ident(@_);
42             }
43              
44              
45             1;
46              
47             __END__