http://qs321.pair.com?node_id=1041003


in reply to Getting information about a remote file via SSH: how to escape the filename

Net::OpenSSH can do it for you:
use Net::OpenSSH; my $ssh = Net::OpenSSH->new($remotehost, user => $remoteuser, password + => $remotepassword); $ssh->die_on_error("unable to connect to remote host"); my ($out, $err) = $ssh->capture2(ls => '-l', $remotefile);

Another option is to use SFTP:

use Net::SFTP::Foreign; use Data::Dumper; my $sftp = Net::SFTP::Foreign->new($remotehost, user => $remoteuser, password => $r +emotepassword, autodie => 1); my $attr = $sftp->stat($remotefile); print Dumper $attr;

Replies are listed 'Best First'.
Re: Getting information about a remote file via SSH: how to escape the filename
by jonadab (Parson) on Jun 27, 2013 at 14:24 UTC

    Thanks. I will definitely look into Net::OpenSSH; that seems like a good way to go for this project.