#!/usr/bin/perl use English; use strict; use Data::Dumper; use Tk; my $qqq = '-l'; my $www = '-l'; # Setup remote ssh connection... my $host='rhost'; use Net::SSH::Perl; #use Net::SSH::W32Perl; # For windows #my $ssh = Net::SSH::W32Perl->new($host) # For windows my $ssh = Net::SSH::Perl->new($host) || die "Bad $host"; $ssh->login('rusr', 'rpass') || die "Bad login"; # Create new window... my $top = MainWindow->new(-title=>'Options Test'); $top->minsize(470,225); my $f = $top->Frame()->pack; my $t = $top->Scrolled('Text')->pack; # Add checkbuttion in frame... $f->Checkbutton(-text=>$qqq, -offvalue=>'', -onvalue=>$qqq, -variable=>\$qqq, -command=>\&hostls, )->pack(-side=>'left'); # Reset checkbutton variable (default is off)... $qqq=''; sub hostls { print STDERR Dumper(\$qqq); print STDERR "qqq=$qqq\n"; $t->delete('1.0', 'end'); my($stdout, $stderr, $exit) = $ssh->cmd("ls $qqq"); # Fails #my($stdout, $stderr, $exit) = $ssh->cmd("ls $www"); # Works if($exit) { warn "Bad Command return\n$stderr"; return() }; $t->insert('end', $stdout); } MainLoop();