Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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

by penguinfuz (Pilgrim)
on Feb 09, 2005 at 11:11 UTC ( #429359=categorized answer: print w/replies, xml ) Need Help??

Q&A > network programming > How do I invoke a procedure on a server remotely? - Answer 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; }

Log In?

What's my password?
Create A New User
[erix]: nice cover with the spitting image of George (and a great solo by Prince at the end )
[Discipulus]: good night monks! i feel fresh as the turkey in the hoven but i need to sleep
[planetscape]: gobble, gobble, Discipulus!
[erix]: Discipulus: buonanotte! :)
[stonecolddevin]: man we need a new guitar legend
[stonecolddevin]: Clapton has issues playing nowadays
[stonecolddevin]: Prince is gone
[stonecolddevin]: Van Halen is still around but I haven't heard any of their new stuff
[erix]: oh, 41M views -- everyone has seen it already then :)
[erix]: Alvin Lee dead too -- we're stuck with Karl, I'm afraid :)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-06-22 21:20 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (531 votes). Check out past polls.