> -----Original Message----- > From: Paul Jasa [mailto:[EMAIL PROTECTED]] > Sent: Saturday, September 08, 2001 7:38 PM > To: [EMAIL PROTECTED] > Subject: Q: Can Perl interact (two-way chat) with other scripts > (processe s)???? > > > Dear fellow Perl afficionados, > > I have run into a bit of a puzzler, wondered if anyone might > have anywhere > to point me on this one: > > I want my Perl script to INTERACT multiple times with another > process, in > this case an Expect script. > > Allow me to explain: Typically, I have written scripts where > the Perl script > calls the Expect script with > > system (/dir/expect-script arguments-to-pass-to-expect-script); > > This is a ONE way, ONE-time conversation, as opposed to an > interaction. The > Perl script talks to the Expect script only ONCE in the line > above, passing > the arguments to the Expect script and executing the Expect > script using > the "system" call. After that one-way conversation > (Perl>Expect), nothing > happens until the Expect script finishes, then Perl continues > on, never > talking to that process again. > > In a new script I am creating, the Perl script needs to talk with the > Expect script more than once, in fact, a conversation needs > to be carried > out between the scripts (I guess that would be called a > conversation between > processes). Unlike my original script above, the new Perl > script will not > just start the process (Expect script) and wait until it's > done, but rather > get info from it, parse that info, select a certain piece X > from it, and > send X back so the Expect script can continue, and so forth, until the > Expect script is done, and THEN Perl will continue on as normal. > > I thought about using the sleep function in Perl, since > Expect also has it, > and have each process (script) sleep for a second or two > while the other one > processes the info it has to pass back to the other script, > however that > sounds like a clusterflub of sleeps with an accident waiting > to happen. > There must be an easier way. > > Since I am really a Perl programmer, I am really trying to > avoid making all > the parsing in the Expect script. I don't even know if > Expect can parse as > well, and as easily, as Perl, and I'd rather avoid that whole > ball of wax. > > Can anyone point me in the right direction? Thank you so > much in advance > for sharing a bit of your expertise, and have a great weekend! CPAN has an Expect module for Perl. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]