rewrite stdin slurping to match example in perldoc -f unpack.
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 28 Feb 2009 19:08:41 +0000 (14:08 -0500)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Sat, 28 Feb 2009 19:08:41 +0000 (14:08 -0500)
src/keytrans/pem2openpgp

index 3492361ad37994655c53c5c7dee2cbc33d5863af..4e6ebe71a21f47d5ab7bfe4d3d6e3d94dc60e5e2 100755 (executable)
@@ -509,12 +509,14 @@ sub pem2openpgp {
 
 
 my $rsa;
+my $stdin;
 if (defined $ENV{PEM2OPENPGP_NEWKEY}) {
   $rsa = Crypt::OpenSSL::RSA->generate_key($ENV{PEM2OPENPGP_NEWKEY});
 } else {
-  # slurp in the entire stdin:
-  undef $/;
-  my $stdin = <STDIN>;
+  $stdin = do {
+    local $/; # slurp!
+    <STDIN>;
+  };
 
   $rsa = Crypt::OpenSSL::RSA->new_private_key($stdin);
 }