#!/usr/bin/perl -w

use strict;

use Frontier::Daemon;
use Registry;

my $registry = Registry->new;

sub sumAndDifference {
    my ($x, $y) = @_;
    return {'sum' => $x + $y, 'difference' => $x - $y};
}

$registry->add_method('sample.sumAndDifference',
		      \&sumAndDifference,
		      signature => [[$Registry::STRUCT,
				     $Registry::INT,
				     $Registry::INT]],
		      help => "Find the sum and difference of two integers.");

# Call me as http://localhost:8080/RPC2
Frontier::Daemon->new(LocalPort => 8080, methods => $registry->methods)
    or die "Couldn't start HTTP server: $!";
