[EMAIL PROTECTED] wrote:
>
> Week two noob here.
>
> I am writing a script to download encrypted files using ftp then after
> they're downloaded decrypt them. I can't seem to get the GPG decrypt
> module to work though. The script does work when I use "system" to
> call another script using gpg directly. Here is the script. I would
> like to use straight perl instead of using system. Any suggestions.
> Also, I am new so any suggestions on proper coding would be helpful.
> Thx. P.S. I realize gpgdecrypt could be done in bash without making
> use of system again. That's easy.
>
> [ftpDecrypt]
>
> #!/usr/bin/perl -w
> use strict;
>
> use Net::FTP;
> my $server_name = "ftp.server.com";
> my $user_name = "useraccount";
> my $pass_word = "password";
> my $secret = "gpgSecret";
>
> my $ftp = Net::FTP->new($server_name, Debug => 0)
> or die "Cannot connect to some.host.name: $@";
>
> $ftp->login($user_name, $pass_word)
> or die "Cannot login ", $ftp->message;
>
> my @directory = $ftp->ls();
> foreach my $dir (@directory){
> if ($dir =~ (/*.gpg/)){
> $ftp->get("$dir") or die "get failed ", $ftp->message;
> system "/dir/to/gpgdecrypt < $dir";
> print "$dir\n";
> }
> }
> $ftp->quit;
>
>
> [gpgdecrypt]
>
> #!/usr/bin/perl -w
>
> chomp($today = `date +%Y%m%d`);
> system 'gpg --batch --passphrase-fd 3 --decrypt $1 3</dir/passph --
> status-fd 1 --output decryptedFile' . "$today";
> ! $? or warn "failed to decrypt\n";
I'm not sure what your question is. Your program doesn't use a Perl GPG module,
and in fact doesn't even compile because /*.gpg/ isn't a valid regular
expression.
All I can suggest at this point is that you should
use warnings;
instead of the -w command-line qualifier, and that we need to see the actual
code that is causing you problems and any error messages that it generates when
you run it.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/