Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

To call remote file.

by Anonymous Monk
on Aug 21, 2007 at 06:05 UTC ( [id://634009] : perlquestion . print w/replies, xml ) Need Help??

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

Hi Monks,

I am new to perl. I like to write one perl script in window which will trigger other perl script in an remote unix system. It is possible ? .

Please tell me some of the module related to this.

Replies are listed 'Best First'.
Re: To call remote file.
by WalkingZero (Sexton) on Aug 21, 2007 at 06:44 UTC
    You mean the parent script is running in windows and you want it to call a pre-existing script on a different box running a UNIX system? There are several ways to do this(after all TIMTWTDI). It would really depends what kind of connection there is between the two boxes for what the best way to handle it is. Are you running file-shares between the two? Telnet? SSH? The best way to do it is going to depend on what kind of access you have available.
      Hi,

      Thanks for your replay,

      1) Not using file-share between two.

      2) access the unix through Telnet.

        That's easy then, just install the Net::Telnet module. You can download it of course from cpan.org. Make sure to read up on the functions, but it should be quite easy to do what you are asking through Telnet.
Re: To call remote file.
by sgt (Deacon) on Aug 21, 2007 at 14:34 UTC

    There are security implications doing this, but yes it is doable using Net::Telnet or Expect. On windows a cygwin perl solution is certainly possible; I am not sure about native perls like ActivePerl or Strawberry Perl.

    a better solution in the long run would be to use a ssh client. Again on cygwin Net::SSH::Perl is OK.

    cheers --stephan
Re: To call remote file.
by tjugo (Initiate) on Aug 22, 2007 at 17:34 UTC
    You can also try something more fancy.
    One possibility could be:
    Windows box -> IO::Socket::INET
    Unix box -> IO::Socket::INET
    Or
    Windows box -> LWP
    Unix box -> Net::HTTPServer

    The nice thing of the second solution is that you can easily trigger the remote script by hand (using a web browser or wget).