http://www.perlmonks.org?node_id=203933

patnil has asked for the wisdom of the Perl Monks concerning the following question:

How do I, from a Perl script, execute another Perl script on another machine?

Thanks in advance.

Replies are listed 'Best First'.
Re: Execute remote Perl scripts
by Abigail-II (Bishop) on Oct 09, 2002 at 15:07 UTC
    The same way as you would execute any other program on said machine. It isn't Perl specific, but it's specific on the remote (and local) machine configuration - and any routers/firewalls in between.

    Typical ways include using rsh (called remsh on some OSses), or UUCP (who remembers working with UUCP?). Unsafe methods, both of them. A someone safer method is the use of ssh - but that's harder to script if you want to make it secure.

    But there are other ways. HTTP for instance, in combination with CGI. Or the use of inetd. You could even share a disk with a remote machine and trigger execution that way.

    Note that none of the method is Perl specific, and none of the methods is a "will work anywhere" solution.

    Abigail

Re: Execute remote Perl scripts
by jj808 (Hermit) on Oct 09, 2002 at 15:08 UTC
    Depends what OS you're using :-)

    For UNIX, try using the system's rsh command (remote shell), or ssh (secure shell). Or you could use Net::Telnet to login to a remote machine and execute the script that way. If that's too insecure, look at the SSH modules.

    PVM and Parallel::Pvm might be worth a try as well if you want to get into distributed processing.

    JJ

    Update:
    Or XML-RPC. Or SOAP. There are quite a few ways to run remote programs...

Re: Execute remote Perl scripts
by shushu (Scribe) on Oct 09, 2002 at 15:13 UTC
    I use PlRPC module to do it. It gives you the ability to control objects and so on another machine, and it is proved as very useful. shushu
Re: Execute remote Perl scripts
by JaWi (Hermit) on Oct 09, 2002 at 15:54 UTC
    Just the other day I was coming across Penguin; which aims to provide a "secure" way to execute remote processes. I didn't really checked it out any further, but it could be of interrest!

    Good Luck!

    -- JaWi

    "A chicken is an egg's way of producing more eggs."