Yenta/Default/MySelf.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 46 CC 2 SCAR 10.3
CC
2
Cov
0%
init
6.0
my_server_id
2.0
my_network_info
2.0
CRAP 2.8
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-Jan-18 18:10 (EST)
6 # Function: info about myself - default implementation
7 #
8 # $Id$
9  
10 package AC::Yenta::Default::MySelf;
11 use AC::Yenta::Config;
12 use AC::Yenta::Debug;
13 use Sys::Hostname;
14 use Socket;
15 use strict;
16  
17  
18 my $SERVERID;
19 my $MYIP = inet_ntoa(scalar gethostbyname(hostname()));
20 die "cannot determine my IP addr.\nsee 'class_myself' in the documentation\n" unless $MYIP;
21  
22 sub init {
23 my $class = shift;
24 my $port = shift; # not used
25 my $id = shift;
26  
27 $SERVERID = $id;
28 unless( $SERVERID ){
29 $SERVERID = 'yenta/' . conf_value('environment') . '@' . hostname();
30 }
31 verbose("system persistent-id: $SERVERID");
32 }
33  
34 sub my_server_id {
35 return $SERVERID;
36 }
37  
38 sub my_network_info {
39 return [ { ipa => $MYIP } ];
40 }
41  
42 sub my_datacenter {
43 return 'default';
44 }
45  
46 1;