Call remote perl script in another script 
Author Message
 Call remote perl script in another script

Hi, there:

I have two Perl scripts which are on two servers (I have to place
them on two servers), say site1-perl and site2-perl. I want to run
site1-perl as a cron job and call site2-perl in site1-perl, let
site2-perl query a database and then return the results to site1-perl.

Both scripts can be accessed using URL naming convention.

Is that possible? Which is the easiest way? I don't want to implement
the httpd protocol by myself.

Please help me out. Thanks.




Sun, 27 Feb 2000 03:00:00 GMT  
 Call remote perl script in another script

Quote:

> Is that possible? Which is the easiest way? I don't want to implement
> the httpd protocol by myself.

Why don't you take a look at the libwww bundle on CPAN (LWP) ???
It implemetds HTTP::Request, Response and UserAgent which should help
you out ... Bob
--

Via Sciangai, 53 00144 Roma - Italy fax int+39(6)5966.4949


Sun, 27 Feb 2000 03:00:00 GMT  
 Call remote perl script in another script


Quote:

> Hi, there:

> I have two Perl scripts which are on two servers (I have to place
> them on two servers), say site1-perl and site2-perl. I want to run
> site1-perl as a cron job and call site2-perl in site1-perl, let
> site2-perl query a database and then return the results to site1-perl.

> Both scripts can be accessed using URL naming convention.

> Is that possible? Which is the easiest way? I don't want to implement
> the httpd protocol by myself.

> Please help me out. Thanks.



You can build your solution using HTTP, or whatever protocol you like.
When you say you don't want to build HTTP yourself - this is the wrong way
to look at this.  HTTP is already a well defined and documented protocol
(search the internet W3 consortiums' page for the appropriate RFC
documents to get the details of this protocol).  Anyway, HTTP is based on
WWW clients and servers - if you already have this infrastructure in
place, then its clearly possible to use CGI scripting and a Web server, as
well as a Perl client program as the basis for this query response
solution.  As well, if all you need to do is a simple query response,
and/or if you don't already have a Web server already in place, its also
fairly trivial for you to write a Perl server application (which must be
continuously running as a server process tied to some unused port) which
would run on site2, as well to write the Perl client application which
basically establishes a socket connection to the specific server.  Once
the socket is established, its trivial to read/and write data through the
socket, based on YOUR defined protocol.  I've done this myself, and I
don't consider myself to be a Perl guru or expert.

ps - perhaps you can help me with my problem.  I have a Web site
(shell.idt.net/~grega9/home_.htm) that has an HTML form.  I have already
written and tested a Perl CGI script that basically takes this form,
manipulates the content found therein, and sends back to the clients
browser a fully formatted form letter that they can locally print to
facilitate their ordering of my products.  Unfortunately, my service
provider wants to charge me $600 year, to upgrade my web service to a
domain class so that I'd have access to run CGI scripts on their server.
I'd be willing to help you out if you could let me run my single CGI
script on one of your web servers.  If you want to discuss this further,



Sun, 27 Feb 2000 03:00:00 GMT  
 Call remote perl script in another script

Yes,

I would suggest you use the 'do' operator in Perl.  Example:  do
(filename) evaluates the Perl code in filename.

#!/usr/bin/perl

do 'doable.pl';
print $path;

Hope it helps.

Quote:

> Hi, there:

> I have two Perl scripts which are on two servers (I have to place
> them on two servers), say site1-perl and site2-perl. I want to run
> site1-perl as a cron job and call site2-perl in site1-perl, let
> site2-perl query a database and then return the results to site1-perl.

> Both scripts can be accessed using URL naming convention.

> Is that possible? Which is the easiest way? I don't want to implement
> the httpd protocol by myself.

> Please help me out. Thanks.





Thu, 02 Mar 2000 03:00:00 GMT  
 Call remote perl script in another script

Quote:
> I have two Perl scripts which are on two servers (I have to place
> them on two servers), say site1-perl and site2-perl. I want to run
> site1-perl as a cron job and call site2-perl in site1-perl, let
> site2-perl query a database and then return the results to
> site1-perl.

Do site1 and site2 have a common filesystem? If so, you can just
use require to load site2-perl into site1-perl.

If they don't share a common filesystem, you could use sockets
to transfer data. Take a look at the URL below, go to the examples
link, download the examples and go to the Networking section. You
will find a message passing library and an RPC library that will
make it considerably easier to make it a client-server system.

Hope this helps.

- Sriram

________________________________________________________________________
Principal Engineer      WebLogic, San Francisco        www.weblogic.com
"Advanced Perl Programming" : http://www.ora.com/catalog/advperl/



Tue, 07 Mar 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Script calling Remote Script

2. Get remote IP in self-calling script

3. Calling a remote script.

4. Running Perl script on remote machine and returning result to script on current machine

5. Newbie: best way to call perl scripts from within a perl script

6. Calling perl scripts from perl scripts

7. call a perl script in another perl script

8. CGI-Calling a Perl script within a Perl script

9. Calling a perl script from within another perl script

10. Perl Scripts from within Perl Scripts called via DBI

11. Calling a perl script from within a perl script

12. Q: Calling perl scripts from perl scripts.

 

 
Powered by phpBB® Forum Software