Yenta/Kibitz/Status/Server.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 29 CC 3 SCAR 20.8
CC
3
Cov
0%
handler
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 8.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: Server.pm,v 1.8 2010/12/07 17:56:07 jaw Exp $
9  
10 package AC::Yenta::Kibitz::Status::Server;
11 use AC::Yenta::Debug 'status_server';
12 use strict;
13  
14  
15 sub handler {
16 my $class = shift;
17 my $io = shift;
18 my $proto = shift;
19 my $gpb = shift;
20 my $content = shift;
21  
22  
23 if( $gpb ){
24 AC::Yenta::Kibitz::Status::update_sceptical( $gpb );
25 }
26  
27 unless( $proto->{want_reply} ){
28 $io->shut();
29 return;
30 }
31  
32 # respond with all known peers
33 my $response = AC::Yenta::Kibitz::Status::response();
34 my $yp = AC::Yenta::Protocol->new();
35  
36 my $hdr = $yp->encode_header(
37 type => 'yenta_status',
38 data_length => length($response),
39 content_length => 0,
40 msgid => $proto->{msgid},
41 is_reply => 1,
42 );
43  
44 debug("sending status reply");
45 $io->write_and_shut( $hdr . $response );
46 }
47  
48 1;