- 论坛徽章:
- 0
|
10可用积分
不知哪位高手是否知道这种情况如何解决:
现在有两个perl脚本,一个在Unix,一个在Windows上
Unix: 脚本的内容是接受用户输入
Windows:在cmd里运行使用rsh远程调用Unix脚本来接受用户输入。
现在问题是,当用户输入内容太快时,窗口冻结,没有反应,像死了一样,请问,这是何故?
如能,解决,不胜感谢!
附Unix上脚本内容:
#!/usr/bin/perl
my $intTimes = 50;
my $intCurr = 1;
while($intCurr < $intTimes)
{
my $strInput = "";
$strInput = PromptUser("Please input");
print "You input: $strInput";
$intCurr++;
}
exit;
sub PromptUser
{
my($promptString,$defaultValue) = @_;
############################################
# Variables
############################################
my $strInput = "";
############################################
if ($defaultValue)
{
print $promptString, "[", $defaultValue, "]: ";
}
else
{
print $promptString, ": ";
}
$| = 1; # force a flush after our print
$strInput = <STDIN>; # get the input from STDIN (presumably the keyboard)
chomp($strInput);
if($defaultValue)
{
return $strInput ? $strInput : $defaultValue; # return $_ if it has a value
}
else
{
return $strInput;
}
} |
|