This is my routine to try encrypting a file. When I run it with -wT it says "broken pipe". With just -w, the program just sits indefinitely. I tried running the script with < master.passwd out of desperation just to see if it might be waiting for the input to come from STDIN. Yields the same "broken pipe" error. I must disclaim again that I don't understand OO very well at all.
my $mpw_file = IO::File->new( "<$mpw" ) || die "\n\nUnable to open master.passwd file. $!\n"; my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, homedir => '/root/.g +nupg' ); $gnupg->options->push_recipients( 'foo@example.com' ); $gnupg->options->meta_interactive( 0 ); my @original_plaintext = <$mpw_file>; ##my $passphrase = "Three Little Pigs"; # We'll let the standard error of GnuPG pass through # to our own standard error, by not creating # a stderr-part of the $handles object. my ( $input, $output, $error, $status_fh ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new() ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output, stderr => $error, status => $status_fh ); # this sets up the communication # Note that the recipients were specified earlier # in the 'options' data member of the $gnupg object. my $pid = $gnupg->encrypt( handles => $handles ); # this passes in the plaintext print $input @original_plaintext; # this closes the communication channel, # indicating we are done close $input; close $mpw_file; my @ciphertext = <$output>; # reading the output my @status_info = <$status_fh>; # reading the status info my @error_output = <$error>; # reading the error print @ciphertext; print @status_info; print @error_output; waitpid $pid, 0; # clean up the finished GnuPG process # }}}

~~
naChoZ


In reply to GnuPG::Interface encryption by naChoZ

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.