From: Mark Carter
Subject: FFI- Perl followup
Date: 
Message-ID: <d3c9c04.0310120649.dc67315@posting.google.com>
Sorry for not including the OP - Usenet is acting arsey with me.



Recently, I have been looking into "distributed computing", partly
because it may be of use to clients (the fee-paying, putting bread on
the dinner table, kind), but mostly because it looked like something
that was really cool.

I scouted around for solutions on python - and there were many. Most
of them seemed tedious to implement. But then I came across XML-RPC,
and I got something up and running in double-quick time. Although not
all-powerful (I think that Soap and Corba are more powerful - but then
again, I don't claim to be an expert), I think it could well fit the
bill for what you are looking for. There's no IDL or compiling
required ala Corba.

For starters, it's a standard mechanism. I know python supports it, so
I'll bet Perl supports it. Maybe Lisp supports it, too. If not, then
maybe it should. XML-RPC is, basically, a protocol for calling other
functions over http.

I suppose a lot depends on how introspective Perl is; because
basically, if Perl knows what functions and arguments its modules
contains, then one could presumably write a small script to tell it to
expose them to a server. The server should be a doddle to write, too.
Then Bob's your uncle, Fanny's your aunt; the whole of CPAN is yours
for the picking.

Here's an example server (OK, so it's not going to win any coding
competitions real soon) written in python:

import SimpleXMLRPCServer
from random import randint

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("dali", 8080))
keep_serving = True


class MyFuncs:
    def div(self, x, y) : return div(x,y)

def echo(txt):
    a = "server says that you said:%s\n" % (txt)
    return a

def closeit(dummy):
    #global server,
    global keep_serving
    keep_serving = False
    return True
    #server.server_close()

def getColours():
    r = randint(1,4)
    r1 = randint(0,255)
    r2 = randint(0,255)
    r3 = randint(0,255)
    return ( r, r1, r2, r3)


print "server starting"
server.register_function(pow)
server.register_function(echo)
server.register_function(closeit)
server.register_function(getColours)
server.register_function(lambda x,y: x+y, 'add')
server.register_introspection_functions()
server.register_instance(MyFuncs())
#server.serve_forever()
#server.server_activate()

while keep_serving:
    server.handle_request()

server.server_close()
print "server closed"





That's the theory, anyway.
From: Steven M. Haflich
Subject: Re: FFI- Perl followup
Date: 
Message-ID: <Mkgib.595$Ta6.470@newssvr27.news.prodigy.com>
Mark Carter wrote:

> For starters, it's a standard mechanism. I know python supports it, so
> I'll bet Perl supports it. Maybe Lisp supports it, too. If not, then
> maybe it should. XML-RPC is, basically, a protocol for calling other
> functions over http.

Allegro has supported XML-RPC since 6.2.  See

http://www.franz.com/support/documentation/6.2/xmlrpc/xml-rpc.txt