GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
IPC::PerlSSH::Library::Run(3) User Contributed Perl Documentation IPC::PerlSSH::Library::Run(3)

"IPC::PerlSSH::Library::Run" - a library of command running functions for "IPC::PerlSSH"

 use IPC::PerlSSH;

 my $ips = IPC::PerlSSH->new( Host => "over.there" );

 $ips->use_library( "Run", qw( system system_out system_in ) );

 my ( $result, $out ) = $ips->call( "system_out", qw( ip addr ls ) );
 $out == 0 or die "ip failed\n";

 for (split m/\n/, $out ) {
    # some processing here...
 }

 my $result = $ips->call( "system", qw( ip addr add 1.2.3.4/28 dev eth0 ) );

 # To execute a shell command, send a single string
 my $result = $ips->call( "system_in", "1", 
    "echo >/proc/sys/net/ipv4/ip_forward"
 );

This module provides a library of functions for executing processes on the remote system. As well as a basic "system()"-like wrapper, there are also functions for passing data in to the executed process's STDIN stream, reading from its STDOUT stream, or both simultaneously.

Each of these functions will only return once the remote process has exited. If interaction with the process is required while it is running, a remote pipe open may be performed instead using functions in IPC::PerlSSH::Library::IO.

The following four functions do not redirect the "STDERR" stream of the invoked program, allowing it to pass unhindered back through the ssh connection to the local program.

Execute a program with the given arguments, returning its exit status.

 my $exitstatus = $ips->call( "system", $path, @args );

To obtain the exit value, use "WEXITSTATUS" from "POSIX".

Execute a program with the given arguments, passing in a string to its STDIN, and returning its exit status

 my $exitstatus = $ips->call( "system_in", $stdin, $path, @args );

Execute a program with the given arguments, returning its exit status and what it wrote on STDOUT.

 my ( $exitstatus, $stdout ) = $ips->call( "system_out", $path, @args );

Execute a program with the given arguments, passing in a string to its STDIN, and returning its exit status and what it wrote on STDOUT.

 my ( $exitstatus, $stdout ) =
    $ips->call( "system_inout", $stdin, $path, @args )

The following four functions capture the invoked program's "STDERR" stream.

Execute a program with the given arguments, returning its exit status and what it wrote on STDERR.

 my ( $exitstatus, $stderr ) = $ips->call( "system_err", $path, @args );

Execute a program with the given arguments, passing in a string to its STDIN, and returning its exit status and what it wrote on STDERR.

 my ( $exitstatus, $stderr ) =
    $ips->call( "system_inerr", $stdin, $path, @args );

Execute a program with the given arguments, returning its exit status and what it wrote on STDOUT and STDERR.

 my ( $exitstatus, $stdout, $stderr ) =
    $ips->call( "system_outerr", $path, @args );

Execute a program with the given arguments, passing in a string to its STDIN, and returning its exit status and what it wrote on STDOUT and STDERR.

 my ( $exitstatus, $stdout, $stderr ) =
    $ips->call( "system_inouterr", $stdin, $path, @args )

Paul Evans <leonerd@leonerd.org.uk>
2022-04-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.