in reply to Re: Perl Expect
in thread Perl Expect

Below is the sub that controls the external program everything else in the program is for controlling the Glade interface. I can provide the rest of the code if needed but I didn't want to muddy up the source of my issues.
sub decrypt_key{ my $Ironkey = '/media/IronKey/linux/ironkey'; my $Ironkey_pwd = 'Enter your IronKey password: '; my $Ironkey_sucess = 'Unlock successful. '; my $Ironkey_badpw = 'password not accepted '; my $data = ($entry->get_text()); chomp($data); $entry->set_text(''); #sleep(2); $exp = Expect->spawn("$Ironkey") or die "Cannot Spawn"; #$exp->debug(3); #$exp->raw_pty(1); $exp->exp_internal(1); #$exp->log_stdout(0); $exp->expect(60, "$Ironkey_pwd"); $exp->send("$data\r"); #$data comes from the password box of the +GUI frontend ## I tried this way as well #$exp->expect(60, # [ qr/password:/ => sub{ $exp = shift; # $exp->send("$data\r\n"); # exp_continue; # }], # ); $exp->soft_close(); #system("nautilus"); Future use }