|o||String values are passed as they stand.|
|o||Booleans and integers will become stringified, but will work as expected once they reach the other side of the connection.|
|o||Floating-point numbers will get converted to a decimal notation, which may lose precision.|
A single array of strings, or a single hash of string values, can be passed
by-value as a list, possibly after positional arguments:
|o||No reference value, including IO handles, can be passed; instead it will be stringified.|
CW$ips = IPC::PerlSSH->new( Host => CW$host, ... )Returns a new instance of a IPC::PerlSSH object connected to the specified host. The following arguments can be specified:
Host => STRING Connect to a named host. Port => INT Optionally specify a non-default port. Perl => STRING Optionally pass in the path to the perl binary in the remote host. User => STRING Optionally pass in an alternative username SshPath => STRING Optionally specify a different path to the ssh binary SshOptions => ARRAY Optionally specify any other options to pass to the ssh binary, in an ARRAY reference
CW$ips = IPC::PerlSSH->new( Command => \@command, ... )Returns a new instance of a IPC::PerlSSH object which uses the STDIN/STDOUT streams of a command it executes, as the streams to communicate with the remote perl.
The Command key can be used to create an IPC::PerlSSH running perl directly on the local machine, for example; so that the remote perl is in fact running locally, but still in its own process.
Command => ARRAY Specifies the command to execute Command => STRING Shorthand form for executing a single simple path
my $ips = IPC::PerlSSH->new( Command => $^X );
CW$ips = IPC::PerlSSH->new( Readh => CW$rd, Writeh => CW$wr )Returns a new instance of a IPC::PerlSSH object using a given pair of filehandles to read from and write to the remote perl process. It is allowable for both filehandles to be the same - for example using a socket.
CW$ips = IPC::PerlSSH->new( Readfunc => \&read, Writefunc => \&write )Returns a new instance of a IPC::PerlSSH object using a given pair of functions as read and write operators.
Usually this form wont be used in practice; it largely exists to assist the test scripts. But since it works, it is included in the interface in case the earlier alternatives are not suitable.
The functions are called as
$len = $Readfunc->( my $buffer, $maxlen ); $len = $Writewrite->( $buffer );
In each case, the returned value should be the number of bytes read or written.
CW@result = CW$ips->eval( CW$code, CW@args )This method evaluates code in the remote host, passing arguments and returning the result.
The code should be passed in a string, and is evaluated using a string eval in the remote host, in list context. If this method is called in scalar context, then only the first element of the returned list is returned.
If the remote code threw an exception, then this function propagates it as a plain string. If the remote process exits before responding, this will be propagated as an exception.
CW$ips->store( CW$name, CW$code )
CW$ips->store( CW%funcs )This method sends code to the remote host to store in named procedure(s) which can be executed later. The code should be passed in strings.
While the code is not executed, it will still be compiled into CODE references in the remote host. Any compile errors that occur will be throw as exceptions by this method.
Multiple functions may be passed in a hash, to reduce the number of network roundtrips, which may help latency.
CW$ips->bind( CW$name, CW$code )This method is identical to the store method, except that the remote function will be available as a plain function within the local perl program, as a function of the given name in the callers package.
CW@result = CW$ips->call( CW$name, CW@args )This method invokes a remote method that has earlier been defined using the store or bind methods. The arguments are passed and the result is returned in the same way as with the eval method.
If an exception occurs during execution, it is propagated and thrown by this method. If the remote process exits before responding, this will be propagated as an exception.
CW$ips->use_library( CW$library, CW@funcs )This method loads a library of code from a module, and stores them to the remote perl by calling store on each one. The $library name may be a full class name, or a name within the IPC::PerlSSH::Library:: space.
If the @funcs list is non-empty, then only those named functions are stored (analogous to the use perl statement). This may be useful in large libraries that define many functions, only a few of which are actually used.
For more information, see IPC::PerlSSH::Library.
Paul Evans <firstname.lastname@example.org>
|perl v5.20.3||IPC::PERLSSH (3)||2016-03-17|