7 use Test::More qw/no_plan/;
10 hostname => @ARGV ? shift @ARGV : 'example.org',
11 username => @ARGV ? shift @ARGV : 'some_user',
12 file => @ARGV ? shift @ARGV : '.bashrc',
13 privatekey => glob("~/.ssh/id_rsa") || glob("~/.ssh/id_dsa"),
15 $config{publickey} = $config{privatekey} . '.pub';
18 use_ok( 'Net::SSH2' );
19 use_ok( 'IO::Scalar' );
21 use_ok( 'File::Glob', qw/:glob/ );
26 ok($ssh = Net::SSH2->new,
29 ok($ssh->connect( $config{hostname} ),
30 "ssh->connect('$config{hostname}')");
32 ok($ssh->auth_publickey(@config{qw/username publickey privatekey/}),
33 "ssh->auth_publickey("
34 . join(', ', map{"'$_'"} @config{qw/username publickey privatekey/})
38 my (@list, $io, $iofile);
40 my $scalar = "## This line starts in the variable before we read the file\n## This line too.\n";
42 ok($io = IO::Scalar->new(\$scalar), "IO::Scalar->new");
43 ok($iofile = IO::File->new(">/tmp/io_file.tmp"),
44 "IO::File->new('>/tmp/io_file.tmp')");
46 ok($ssh->scp_get($config{file}, $io),
47 "ssh->scp_get($config{file}, \$io) # trying to retrieve file into IO::Scalar"
50 diag("Now printing remote file from IO::Scalar:");