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