|Perl: the Markov chain saw|
Open2, eval & handle-behaviourby Fré (Initiate)
|on Jan 25, 2013 at 16:34 UTC||Need Help??|
Fré has asked for the
wisdom of the Perl Monks concerning the following question:
I'm getting totally confused with getting my in- & outputs here.
I'm supposed to run some query-stuff in forks, using an old perl 5.6-window$-thing, and its basic pre-installed mods.
Trying a logout first, then a good login and further processing with other commands. It's not supposed to end or return to the shell, just needs to continue, hence my eval-tryout. If 'logout' doesn't find a valid login to finish, then he just asks for a user&passwd, in normal cmdline-situations through STDIN.
So, I've been trying to intercept that behaviour and send back the necessary values trough many different combinations. But I don't seem to manage...
Tried writing to STDIN, tried running from STDOUT, from $chld_frm, tried switching the parameters... Name it. (I actually never really tried mixing all those handles, so I guess that after copy-pasting-changing it's full of mistakes.)
I seem to start mixing all kind of file-handle-variable-types, without ever being able to read & write what open2 should be able to give me.
A prompt "User: ", and couple of milliseconds later "Passw: "...
So, for Perl's sake, don't get me losing my faith!