Net::SSH2::Simple - Simpler interface to Net::SSH2
Version 0.01
Net::SSH2::Simple provide limited but simpler interface to Net::SSH2.
Perhaps a little code snippet.
use Net::SSH2::Simple; my $ssh2 = Net::SSH2::Simple->new(); ... { my ($stdout,$stderr, $exitcode) = $ssh2->cmd( "uname -sr" ) or die "cannot execute uname: $self->error"; if ($exitcode == 0) { print $stdout if $stdout; print $stderr if $stderr; } else { print $stderr if $stderr; die "uname failed with exit code $exitcode"; } } ... { my ($stdout,$stderr, $exitcode) = $ssh2->cmd( "ls -latr", 'timeout' => 5_000, 'bufsize' => 4_096 ); }
sub cmd
head1 CAVEAT
cmd: only one command line can be executed over this channel. No "ls -l;whoami" combo. Use ssh->shell instead
head1 WORKAROUND
cmd: use parenthesis for cmd combo
... { my ($stdout,$stderr,$exit)=$ssh->cmd("(echo \"workaround\" ; nice ps auxw)") or die "Cannot exec combo: $self->error"; }
remi, <remi at chez.com>
<remi at chez.com>
Please report any bugs or feature requests to bug-net-ssh2-simple at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-SSH2-Simple. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-net-ssh2-simple at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Net::SSH2::Simple
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-SSH2-Simple
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-SSH2-Simple
CPAN Ratings
http://cpanratings.perl.org/d/Net-SSH2-Simple
Search CPAN
http://search.cpan.org/dist/Net-SSH2-Simple/
Copyright 2009 remi.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Net::SSH2::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SSH2::Simple
CPAN shell
perl -MCPAN -e shell install Net::SSH2::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.