IChat.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« IChat/Message/Text.pm ↑ Summary
1 package Net::IChat;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶use EO;
Subroutine BEGIN: called CC=1 SCAR=2.6
7 use Net::Rendezvous;
8 use Net::IChat::Client;
9 use Net::Rendezvous::Publish;
10 use Class::Accessor::Chained;
11 use base qw( EO Class::Accessor::Chained );
12  
13 our $VERSION = '0.01';
14  
15 {
16 # Work around bug in Net::DNS::Packet's dn_expand_XS
17 no warnings 'redefine';
18 *Net::DNS::Packet::dn_expand = \&Net::DNS::Packet::dn_expand_PP;
19 }
20  
21 sub me {
22 my $class = shift;
23 Net::IChat::Client->new();
24 }
25  
26 sub clients {
27 my $class = shift;
28 my $res = Net::Rendezvous->new('presence');
29 $res->discover;
30 [ map { Net::IChat::Client->new->mdns_entry( $_ ) } $res->entries ];
31 }
32  
33 1;
34  
35 =head1 NAME
36  
37 Net::IChat - use apple's iChat as a messaging tool
38  
39 =head1 SYNOPSIS
40  
41 use Net::IChat;
42 use Net::IChat::Client;
43  
44 my $me = Net::IChat->me();
45 $me->announce;
46  
47 my $clients = Net::IChat->clients();
48 if (@$clients) {
49 my $conversation = $clients->[0]->converse();
50 $conversation->send('Hello');
51 my $mesg = $conversation->receive();
52  
53 if ($mesg->can('body')) {
54 print $mesg->body;
55 }
56 }
57  
58 =head1 DESCRIPTION
59  
60 Net::IChat allows you to write clients for Apple's Rendezvous iChat.
61  
62 =cut
« IChat/Message/Text.pm ↑ Summary