在Perl中使用xml-rpc的实例

不用多说了
#!/usr/bin/perl
 
use XMLRPC::Transport::HTTP;
 
XMLRPC::Transport::HTTP::CGI
-> dispatch_to('World')
-> handle;
 

package World;
 
sub new {
  bless {}, shift;
};
 
sub HelloWorld {
my ($self) = @_;
return "Hello World\n";
};
 
sub GoodByeWorld {
my ($self,$adjective) = @_;
return "Goodbye $adjective World\n";
}
 

////////// 以下是客户端
#!/usr/bin/perl
 
use XMLRPC::Lite;
print "Content-type: text/html\n\n";
 
 
print XMLRPC::Lite
  -> proxy('http://202.195.160.145/webmin-rpc/xmlrpc.cgi')
  -> call('World.HelloWorld')
  -> result;


Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=477534


你可能感兴趣的:(perl)