http://www.perlmonks.org?node_id=662976


in reply to Re: Need help with Algorithm::Permute and openssl
in thread Need help with Algorithm::Permute and openssl

'art' is reached every time but only if I comment out the system line. If I leave the system call in, 'art' appears to never be reached. That's the only reason this test is in there (to prove that point):
if ($perm eq "art"){ # If system command is run below, this test is never true. # So system command changes $perm is some way # WTF? print "found $perm \n"; die; }
As for what is happening to $perm to do this (unset, altered in some way) I have no idea - otherwise I would have said so.

Replies are listed 'Best First'.
Re^3: Need help with Algorithm::Permute and openssl
by ikegami (Patriarch) on Jan 17, 2008 at 23:25 UTC

    No, if anything, that test proves that "art" wasn't reached.

    You have a print just before that if. Do you see it printing "art"? And again, if it does get cleared or corrupted, what does that print print? What's the last thing it prints that isn't corrupted? You already have the debugging statements in place, tell us what they show!

      Thanks for your help but perhaps I need to be clearer. If I run that code as is (try it?), art never gets reached. $perm never equals "art", since if it did it would die and print "found art", which is does not. openssl never returns success either, so the system command never returns sucess, so that second die is not triggered either. So the program just keeps printing perms.

      BUT if, and only if, I comment out that system call to openssl, art is reached quite quickly, and "found art" gets printed. If I simply set $perm = "art" before the system command (overriding whatever Algorithm::Permute has set it to), openssl decrypts the test file fine. openssl returns success, the program dies and prints "Found passphrase "art"".

      From all of which I conclude that $perm should get passed to openssl fine, but that, for some reason, it doesn't take the passphrase string 'art' if that system line is left in.

      You see why I'm puzzled?

      Are things happening in other than the order they seem to be?

        So the program just keeps printing perms.

        For the third time, what perms does it print?