| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::IChat; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 638 | use strict; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 397 | use EO; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 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 |