Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

How do I invoke a procedure on a server remotely?

by Anonymous Monk
on Apr 03, 2000 at 17:58 UTC ( [id://6721]=perlquestion: print w/replies, xml ) Need Help??

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

I have a script on web server and I would like to invoke a script on another server from this script. How do I go ahead with it . Help Needed ASAP -Vishu

Originally posted as a Categorized Question.

  • Comment on How do I invoke a procedure on a server remotely?

Replies are listed 'Best First'.
Re: How do I invoke a procedure on a server remotely?
by cmk (Initiate) on Apr 24, 2019 at 02:07 UTC
    RPC::PlServer This assumes that you want to run perl methods on a remote server under your control. And that you have some idea how you will handle security.
Re: How do I invoke a procedure on a server remotely?
by penguinfuz (Pilgrim) on Feb 09, 2005 at 11:11 UTC
    Another option, assuming you've got a working SSH connection between the machines is to use Net::SSH::Perl.
    Note: Cpan search seems to be having issues at the moment so here's an alternative location - Net::SSH::Perl.
    sub run_remote_script { use Net::SSH::Perl; my ($host,$user,$pass,$opt1,$opt2,$opt3) = @_; my $cmd = "/path/to/remote_script $opt1 $opt2 $opt3"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user,$pass); my %output; ($output{stdout},$output{stderr},$output{exit}) = $ssh->cmd($cmd); return \%output; }
Re: How do I invoke a procedure on a server remotely?
by chromatic (Archbishop) on Apr 03, 2000 at 18:57 UTC
    If you want to get the output from another script, it's as simple as using LWP::Simple. See How can I load a webpage into my program?. That assumes that the script on another server is CGI and available through HTTP access.

    If you're looking to execute a script through rsh or ssh or telnet, look for the Expect module. You can write something like a chat script with it.

Re: How do I invoke a procedure on a server remotely?
by casiano (Pilgrim) on Nov 05, 2007 at 17:37 UTC
    If you can establish an automatic ssh connection with the server, use GRID::Machine
Re: How do I invoke a procedure on a server remotely?
by btrott (Parson) on Apr 03, 2000 at 21:04 UTC
    It sounds like you're just asking about invoking a remote script as you might through a web browser (as opposed to a particular procedure). But just in case you were asking about RPC: How can I do RPC in Perl?.
Re: How do I invoke a procedure on a server remotely?
by Mago (Parson) on Jul 08, 2003 at 20:46 UTC
    my $tn; # Telnet connection initilized sub TNcommand { my($command) = $_[0]; &RunLog (" : Running command = $command"); $tn->cmd(String => $command, Prompt => '/\>$/'); return; } sub TNprint { my($command) = $_[0]; &RunLog (" : Running print command = $command"); $tn->print("$command"); return; } sub TNwriteFile { my($out_fname) = $_[0]; my($NextLine) = "1"; open (SAIDA, ">$out_fname"); while ($NextLine) { if ($NextLine = $tn->getline(Timeout => 15)) { $NextLine =~ s/\r//; print SAIDA $NextLine; } } close SAIDA; return; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://6721]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-20 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found