All, I am using gpg ( opensource encryption/decryption tool) to send files via ftp to a remote site. In my WIN32 Perl program I am trying to figure how I would do this equivalent in Unix...
#> cat gpgpass |gpg - - "all the options" newfile encryptedfile The gpgpass is the password that will enable decryption to occur and it has to be piped into the gpg binary as above. Here is my program #!/usr/bin/perl use strict; use warnings; use diagnostics; use Net::FTP; require 5.8.0; $ENV{"PATH"} = qq(C:\\Perl\\bin:C:\\Documents and Settings\\mh-hl7:C:\\Program Files\\GNU\\GnuPG\\); my $p = qq(--passphrase-fd 0); my $de = qq(--decrypt); my $outp = qq(--output); my $ascfile = qq(MHFM.txt.asc); my $gpgpass = q{}; my $MHfile0 = qq(C:\\temp\\derek); #my $MHfile1 = qq(C:\\Documents and Settings\\mh-hl7\\MHFM.txt.asc); my $MHfile1 = qq(C:\\Program Files\\DzSoft\\Perl Editor\\Samples\\MHFM.txt.asc); my $pass = qq(C:\\temp\\pass.txt); sub ftpme { my $remotehost = "216.54.146.8"; my $remotedir = "cloverleaf"; my $localdir = "C:\\Documents and Settings\\mh-hl7"; my $user = "...."; my $pass = "....."; my $data = "$ascfile"; my $ftplog = "C:\\temp\\ftpxfer_to_OH.log"; open (FTPLOG, ">$ftplog") or warn "was unable to open FTPLOG $!"; my $ftp = Net::FTP->new($remotehost, Debug => 10) or do {print FTPLOG "Cannot connect to $remotehost $!";}; $ftp->login($user,$pass) or do {print FTPLOG "Login failed $!";}; $ftp->binary(); $ftp->cwd($remotedir); $ftp->get($ascfile) or do {print FTPLOG "Get data failed $!";}; $ftp->quit; } unlink $MHfile0 or warn "was unable to unlink old file $!"; ftpme(); rename("$MHfile1","$MHfile0") or die "was unable to cp file to $MHfile0 $!"; if ( -s $MHfile0 ) { open (PASS, "+<$pass") or warn "was unable to open FH $!"; for (;<PASS>;) { $gpgpass = $_; } print $gpgpass | system ("C:\\Program Files\GNU\GnuPG\gpg $p $de $outp $MHfile0 $ascfile"); # I know the above will not work but this is what it should conceptually look like. } #else { # print "file $ascfile not present","\n"; # system ("C:\\WINDOWS\\notepad.exe C:\\temp\\pass.txt"); #} close (PASS) or warn "was unable to close FH $!"; Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>