NAME

Net::SSH2::Channel - SSH 2 channel object

DESCRIPTION

A channel object is created by the Net::SSH2 channel method. As well as being an object, it is also a tied filehandle.

setenv ( key, value ... )

Sets remote environment variables. Note that most implementations do not allow environment variables to be freely set. Pass in a list of keys and values with the values to set. Returns the number of successful sets.

blocking ( flag )

Enable or disable blocking.

eof

Returns true if the remote server sent an EOF.

send_eof

Send an EOF to the remote. After an EOF has been sent, no more data may be sent; the connection should be closed.

close

Close the channel (happens automatically on object destruction).

wait_close

Wait for a remote close event. Must have already seen remote EOF.

exit_status

Returns the channel's program exit status.

pty ( terminal [, modes [, width [, height ]]] )

Request a terminal on a channel. If provided, width and height are the width and height in characters (defaults to 80x24); if negative their absolute values specify width and height in pixels.

process ( request, message )

Start a process on the channel. See also shell, exec, subsystem.

shell

Start a shell on the remote host; calls process("shell").

exec ( command )

Execute the command on the remote host; calls process("exec", command).

subsystem ( name )

Run subsystem on the remote host; calls process("subsystem", command).

ext_data ( mode )

Set extended data handling mode:

normal (default)

Keep data in separate channels; stderr is read separately.

ignore

Ignore all extended data.

merge

Merge into the regular channel.

can_read

Returns true iff there is data available to read (see also Net::SSH2 poll).

can_write

Returns true iff writing to the channel will not block.

read ( buffer, size [, ext ] )

Attempts to read size bytes into the buffer. Returns number of bytes read, undef on failure. If ext is present and set, reads from the extended data channel (stderr).

read_all ( buffer, size [, ext ] )

Like read, but on a socket timeout, will retry until it reads the requested bytes or encounters an error.

write ( buffer [, ext ] )

Attempts to write the buffer to the channel. Returns number of bytes written, undef on failure. If ext is present and set, writes to the extended data channel (stderr).

flush ( [ ext ] )

Flushes the channel; if ext is present and set, flushes extended data channel. Returns number of bytes flushed, undef on error.

SEE ALSO

Net::SSH2.

AUTHOR

David B. Robins, <dbrobins@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by David B. Robins; all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.