Zentara wrote:



Since you are not showing us your code, we can only guess.
My guess is that you are not setting up the gpg command properly.

Here is what I now have...

use IPC::Open3;

local(*HIS_IN, *HIS_OUT, *HIS_ERR);

$childpid = open3(*HIS_IN, *HIS_OUT, *HIS_ERR, 'gpg --edit root');
sleep 5;

print HIS_IN "trust\n";
chomp(my $answer = <HIS_OUT>);
print $answer;
if ($answer =~ /Your decision/) {
        print HIS_IN "5\n";
}
else {
        print "decision error $!\n";
        exit;
}

chomp (my $answer1 = <HIS_OUT>);
if ($answer1 =~ /^Do you really/) {
        print HIS_IN "yes\n";
}
else {
        print "sure error $!\n";
        exit;
}



The first thing that jumps out at me when I look at man gpg, is:

 Please remember that option parsing stops as soon as a non
       option  is  encountered,  you  can  explicitly stop option
       parsing by using the special option "--".

So gpg is just sitting there, waiting for more input, you need to find
out why.

gpg is starting up fine. It is not a question of options that I'm passing it to open it. It's the fact that my code is not interacting with it once it's open

Alot of little details can go wrong. Maybe you need to tweak the way
the filehandles are referenced.

This is really where I am after help as my perl is not really that advanced.

But Thomas Baltzer's advice is right-on:  look at the other modules, and
see how they do it.

yes I checked out Crypt::GPG, and that interacts with gpg by using IPC::Run in an Expect like manner. Unfortunately, IPC::Run does not come as part of the standard perl distro either.

Thanks
Darren

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to