Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Need help with Algorithm::Permute and openssl

by ikegami (Pope)
on Jan 17, 2008 at 23:13 UTC ( #662975=note: print w/replies, xml ) Need Help??

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

it is as if openssl somehow unsets or corrupts the contents of $perm

Which one is it? What does it contain? Are you sure it's actually reaching art?

Replies are listed 'Best First'.
Re^2: Need help with Algorithm::Permute and openssl
by wdef2 (Acolyte) on Jan 17, 2008 at 23:21 UTC
    '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.

      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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://662975]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2018-06-25 19:53 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (128 votes). Check out past polls.