I'm trying to figure out what's happening, but for some reason I don't get any output after 'print $to_gpg':

use strict; use warnings; use utf8; use Data::Dumper; use GnuPG::Interface; STDOUT->autoflush(1); my $gpg_pass = $ENV{'GPG_PASSWORD'}; print Dumper(encrypt("hello world", "swilson")); sub encrypt { my ($text, $email) = @_; return "No data" if (not defined($text) or ref($text) ne 'ARRAY'); print "In encrypt email: [$email]\n"; my @recipients; push @recipients, $email; my $oGpg = GnuPG::Interface->new(); push (@{$oGpg->options->extra_args}, '--keyserver-options', 'no-auto +-key-retrieve' ); $oGpg->options->hash_init( meta_interactive => 0, always_trust => 1, armor => 1, homedir => './gnupg', recipients => [@recipients], ); my ($gpg_to, $gpg_from, $gpg_err, $gpg_stat, $gpg_log) = (IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new()); my $handles = GnuPG::Handles->new( stdin => $gpg_to, stdout => $gpg_from, stderr => $gpg_err, status => $gpg_stat, logger => $gpg_log, ); foreach my $handle ($gpg_to, $gpg_from, $gpg_err, $gpg_stat, $gpg_lo +g) { $handle->autoflush(1); } $oGpg->passphrase($gpg_pass); my $pid = $oGpg->sign_and_encrypt(handles => $handles); print "In encrypt pid: [$pid]\n"; print $gpg_to @$text; print "In encrypt HERE0\n"; close $gpg_to; print "In encrypt HERE1\n"; my $raCiphertext; @$raCiphertext = <$gpg_from>; # reading the output my @aErrorOutput = <$gpg_err>; # reading the error my @aStatusInfo = <$gpg_stat>; # read the status info print "In encrypt HERE2\n"; # Cleanup foreach my $handle ($gpg_from, $gpg_err, $gpg_stat, $gpg_log) { $handle->close; } print "In encrypt HERE3\n"; waitpid $pid, 0; print "In encrypt raCiphertext: [" . @$raCiphertext . "]\n"; return "No data" if (ref($raCiphertext) ne 'ARRAY' or scalar(@$raCip +hertext) == 0); my $result = result_check($email, @aStatusInfo); return $result, $raCiphertext; }

In reply to GnuPG::Interface preventing print by ag4ve

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.