#!/usr/bin/perl

use strict;
use Frontier::Daemon;

my $heyu = 'heyu';
my $server = new Frontier::Daemon( LocalPort => 8042,
				   methods => { 'turn'=> \&x10_turn,
						'info' => \&x10_info,
					    }
				   );

sub x10_turn {
    use Data::Dumper;
    print "calling x10_turn:\n";
    print Dumper \@_;
    system($heyu, 'turn', @_ );
}

sub x10_info {

    print "calling x10_info\n";
    unless( open INF, "$heyu info|" ){
	warn "cannot open x10 for info read\n";
	return;
    }
    my $info = join '', <INF>;

    return $info;
}
