Perl: the Markov chain saw | |
PerlMonks |
Expect.pm and STDIN questionby Archon810 (Initiate) |
on Jan 07, 2009 at 21:09 UTC ( [id://734730]=perlquestion: print w/replies, xml ) | Need Help?? |
Archon810 has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow monks. I am hoping you can help me with an Expect question. I'll try to explain it as clearly and briefly as possible.
I'm trying to automate some cpan module installation, but it seems like cpan isn't allowing to auto-yes all inputs and I can't even disable the Is it OK to try to connect to the Internet [yes] prompt. So, I wrote a little Expect script that would send "\n" to everything that matches [.*?]. Here it is, with a few random modules. The only problem (and it's not really an issue but I'd like the script to be clean), is it triggers on things like this, that don't even have an STDIN prompt: I do not want to make a whitelist or a blacklist of things that should or should not trigger sending the "\n". Ideally, it would only send anything if the line is followed by an STDIN prompt. So the question to you all, mighty monks, can one detect an STDIN prompt in Expect and only perform an action if it's there, for example on the same line as the text being regexed? Please let me know if I'm not being clear enough.
Artem
Back to
Seekers of Perl Wisdom
|
|