# daemon
use warnings;
use strict;
use SOAP::Transport::TCP;
my $daemon = SOAP::Transport::TCP::Server
-> new (LocalAddr => 'localhost', LocalPort => 2323, Listen => 5, Reuse => 1)
-> dispatch_to('/home/jwest/stest')
;
print "Daemon established at ", join(':', $daemon->sockhost, $daemon->sockport), "\n";
$daemon->handle;
__END__
####
package Foo;
use warnings;
use strict;
sub bar { "baz!\n"; }
1;
__END__
##
##
# client
use warnings;
use strict;
use SOAP::Lite;
my $soap = SOAP::Lite
->uri("tcp://localhost/Foo")
->proxy("tcp://localhost:2323")
;
my $res = $soap->bar();
if ($res->fault) {
print "What we have here is a failure to communicate...\n";
print $res->faultstring;
} else {
print $res->result;
}
__END__