All pastes #826385 Raw Edit

Someone

public text v1 · immutable
#826385 ·published 2007-12-21 04:28 UTC
rendered paste body
#!/usr/bin/perl
use Net::Telnet;
use Switch
$host = "localhost";
$port = 6546;

$telnet = new Net::Telnet ( Timeout=>10,
                            Port=>$port);

$telnet->open( $host );
$telnet->waitfor('/#/i');
$telnet->print('query location');
my $location = join("",$telnet->waitfor(Match => '/(MainMenu|Playback LiveTV|GuideGrid|#)/i'));

switch ($location) {
	case ' Playback LiveTV'	{ print "in tv\n";$telnet->print('key s'); }
	case ' MainMenu'	{ print "in menu\n";$telnet->print('jump livetvinguide'); }
	case ' GuideGrid'	{ print "in grid\n";$telnet->print('key escape'); }
	else 			{ print "do nothing\n"; }
}

$telnet->print('exit');