XML-RPC in Perl

From Yefu's notes
Jump to: navigation, search

Perl's Frontier::RPC library是非常简单有效的东西。文档在这里

RPC::Simple的文档我感觉有电晦涩。看不懂。

#!/usr/bin/perl


use strict;
use warnings;
use Frontier::Daemon;
	
my $d = Frontier::Daemon->new(
			      methods => {
					  sum => \&sum,
					 },
			      LocalAddr => 'marian.daisypark.net',
			      LocalPort => 1080,
			      );
	
	sub sum {
	  my ($arg1, $arg2) = @_;
	
	  return $arg1 + $arg2;
}