malokam has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks. Perl noob here and already learned a lot from these forums. Thanks for the responses in my previous post. Below are my Perl/System details
pgp->perl -v This is perl, v5.10.1 (*) built for aix-thread-multi pgp->perl -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration +: Platform: osname=aix, osvers=6.1.2.0, archname=aix-thread-multi uname='aix powerpc unknown aix ' config_args='-desr -Dinstallprefix=/usr/opt/perl5 -Dprefix=/usr/op +t/perl5 -Dcc=xlc_r -Duseshrplib -Dusethreads' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=undef, use64bitall=undef, uselongdouble=undef
I am trying to automate some PGP encryption/decryption and I have a situation. I am saving the output of certain PGP commands with something like this. Now in case of errors, the following set of strings would show up in the output.
3001:input file not found 1080:no private key could be found for decryption 1053:signing key not found 3013:no keys found 3011:invalid passphrase specified 3011:invalid passphrase specified 3090:operation failed, file not found 3028:multiple inputs cannot be sent to a single output file
When I try to compare the outputs with the strings, I am having issues. If I use a single string like "successfully" I am able to use the ~~ operator in Perl V5.10.1 How do I leverage ~~ operator with multiple strings?
$program_output3 = `pgp --<various arguments>`; if($program_output3 ~~ /"file wiped successfully"/i) { print "File encrypted successfully\n"; } elsif($program_output3 ~~ /"operation failed, file not found"/i) { print "signing key is not found?"; } elsif($program_output3 ~~ /"no keys found"/i) { print "Please check if the customer's signing key exists on our ri +ng"; }
I even tried creating an array with the error codes and loop through that array and compare with program output with ~~. Still no luck. Problem with trying to use something else like "List::MoreUtils qw" is that I cannot install any new modules on this server. (Due to various reasons that I cannot explain)
|
|---|