Yenta/Kibitz/Status/Server.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 3 SCAR 19.5
CC
3
Cov
0%
handler
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1 # -*- perl -*-
2  
3 # Copyright (c) 2009 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2009-Mar-30 10:19 (EDT)
6 # Function:
7 #
8 # $Id$
9  
10 package AC::Yenta::Kibitz::Status::Server;
11 use AC::Dumper;
12 use AC::Yenta::Debug 'status_server';
13 use strict;
14  
15  
16 sub handler {
17 my $class = shift;
18 my $io = shift;
19 my $proto = shift;
20 my $gpb = shift;
21 my $content = shift;
22  
23 if( $gpb ){
24 AC::Yenta::Kibitz::Status::update_sceptical( $gpb, $io );
25 }
26  
27 unless( $proto->{want_reply} ){
28 $io->shut();
29 return;
30 }
31  
32 AC::Yenta::NetMon::update( $io );
33  
34 # respond with all known peers
35 my $response = AC::Yenta::Kibitz::Status::response();
36 my $yp = AC::Yenta::Protocol->new();
37  
38 my $hdr = $yp->encode_header(
39 type => 'yenta_status',
40 data_length => length($response),
41 content_length => 0,
42 msgid => $proto->{msgid},
43 is_reply => 1,
44 );
45  
46 debug("sending status reply");
47 $io->write_and_shut( $hdr . $response );
48 }
49  
50 1;