MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Gloabl sub only working with debug on?




  Man.. Thanks to Mike for emailing me and letting me know what a DA* I
was being.  Please ignore my previous response.  However, in the mean time
I had found another solution.  (Apparently open2 & open 3 have a problem
with working with the CGI module as well)  Here it is.

## Subroutine to encrypt input with user 'user's key.  
## Returns PGP encrypted data
GlobalSub <<EndOfSub
sub pgp_encrypt {

  my($input) = @_;
  my($line, $escaped_input, $output);

  $escaped_input = qq{$input};

  open(ENCRYPTED, "echo \"$escaped_input\" | /usr/www/vianexus/bin/pgp
+batchmode -feat user 2> /dev/null |") ||
        die "Couldn't open pgp: $!\n";

  $output = "";
  while(defined($line = <ENCRYPTED>)) {
    $output .= $line;
  }
  close(ENCRYPTED);

  return $output;
}
EndOfSub


  Again, thanks to Mike for his solution.

  -Nick

* DA = DumbAss.  I was confuing pgp-encrypt with pgp_encrypt, assuming
that with the email address there, it was sending the encrypted response
to an email address.  

On Mon, 28 Jun 1999, Nicholas Albright wrote:

> ******    message to minivend-users from Nicholas Albright <albrnick@bobcat.ent.ohiou.edu>     ******
> 
> On Mon, 28 Jun 1999 mikeh@minivend.com wrote:
> 
> > ******    message to minivend-users from mikeh@minivend.com     ******
> > 
> > Quoting Nicholas Albright (albrnick@bobcat.ent.ohiou.edu):
> > > 
> > > 
> > >   I am having a probelm with getting the output of a open3 command.  I
> > > seem to only actually get the output when minivend is run in it's debug
> > > mode.  I append many different things to $output as I go through the sub,
> > > to check that I'm doing what I'm thinking I'm doing.  But when minivend is
> > > run normally, I only get the output from my check assignments.  I never
> > > seem to get the output of my open3 program.  This program works as a stand
> > > alone perl program.
> > 
> > You might read the caveats and warnings that abound in IPC::Open3.
> > Since MV closes STDOUT and STDERR in forking mode.....
> 
>   Ahh..! Thanks!  That would explain it.  :)  My problem is that I don't
> want to e-mail the result, but rather encrypt some data before I insert it
> into the database, and decrypt it on the way out.
> 
>   Any other suggestions?
>    -Nick "Thanks for the response!" Albright
> 
> 

-- 

"Anyone who can only think of one way to spell a word obviously 
lacks imagination."  

		-- Mark Twain




Search for: Match: Format: Sort by: