On Fri, 19 Nov 1999, Jason Earl wrote:
> > Postgresql is installed on server moe and works just fine.
> > I can access it using PHP scripts located on server moe or server bart.
> > Pg.pm perl module is installed on server moe.
> > I can access Postgres just fine using perl cgi's on moe.
> > Isn't this a nice story?
>
> > Now, I want to use a perl script on server bart to access my PG installation
> > on server moe but to install the Pg module on bart requires that Postgresql
> > be installed first.
>
> > Ultimately, I want to use perl scripts spread all over the network to access
> > the PG installation on one server only. I don't want to have to install
> > postgres everywhere just to install the perl module.
I use a totally different approach to solve the same problem:
Write a perl script that resides on the postgres server and does whatever
you want those "distributed" scripts to do. In addition, it can open a
TCP/IP port and listen on it.
Clients open a TCP/IP connection to the server (to the port), and pass on
the required information to the perl script. The script does its thing and
returns the result(s) back to the client (on the TCP/IP connection), and
closes the connection.
To be able to cater for more than one client at a time, you can write the
perl script to spawn a child to serve each client.
This way the clients need not have Pg.pm. Hell, they don't even need to
have perl. You can use any program that can open a TCP/IP connection
(which means almost everything under the sun--including even VB).
The actual "meat" of the perl script should be around 20-30 lines (except
the postgres stuff of course).
cheers,
Hossein