Yes, and in fact it uses IO::Select internally.
You could consider it a wrapper around IO::Select that lets you use the fairly comfortable perl idiom:
# open up a process that spits out prompts and occasionally
# suddenly spews screenfuls of data
while (<PROCESSOUTPUT>)
{
chomp;
if (/some prompt:/) {
# kicked out because of the timeout
# respond as appropriate
...
}
elsif (/first type of data/) {
# kicked out because a newline was sent.
...
}
elsif (/second type of data/) {
...
}
...
}
It's all about making the rest of your code more readable/useful. The thing is, you'd really like to read most of the program's output with <>, but you never know when the program will stop spewing data and suddenly hand you a prompt without a trailing newline. (such as Solaris's tar prompting you to change tapes) You'd rather not clutter up your main code with distinguishing between whether you got a newline or not. |