Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Answer: How do I invoke a procedure on a server remotely?

( #429359=categorized answer: print w/ replies, xml ) Need Help??

Q&A > network programming > How do I invoke a procedure on a server remotely? contributed by penguinfuz

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; }

Comment on Answer: How do I invoke a procedure on a server remotely?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2015-07-06 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls