#!/usr/bin/perl -w $| = 1; $host=`uname -n`; $hostid=`hostid`; $plat=`uname -a`; chomp $host; chomp $hostid; chomp $plat; tivoSend('TiVoConnect', 1, 'Machine', $host, 'Identity', "hostid-$hostid", 'Method', 'connected', 'Platform', $plat, 'Services', 'TiVoMediaServer:80/http'); while (tivoRecv()) { } exit 0; sub tivoRecv { my $in; if (sysread(STDIN, $in, 4)) { my $len = unpack('N', $in); if (sysread(STDIN, $in, $len)) { warn "beacon inbound:\n----------------------\n" . "$in\n----------------------\n"; return 1; } } } sub tivoSend { my(@args) = @_; my $buf = ''; while (scalar(@args)) { my $tag = shift @args; my $val = shift @args; $buf .= "$tag=$val\n"; } print pack('N', length($buf)), $buf; }