Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Can anyone please tell me how to do that.Any help would be greatly appreciated
Thanks,
Sajid
my $pid = open2( \*Reader, \*Writer, "passwd" ) or warn $!;
Writer->autoflush();
Reader->autoflush();
STDIN->autoflush();
$SIG{ALRM} = sub {die}; # required for alarm call below
do {
print ": "; # simple prompt
#my $cmd = <STDIN>;
#print Writer $cmd;
my $got;
while (1) {
eval { alarm 3; $_=<Reader> }; # get line in 3 seconds or stop reading
$got .= $_; // Line X
print Writer "mypassword1";
alarm 0;
last if ($@ or !(defined($_))); # exit loop if there was a timeout or no data
#$got .= $_;
#print $got
}
# print $got;
} while(1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perlipc open2 question
by betterworld (Curate) on May 22, 2007 at 11:52 UTC | |
by Anonymous Monk on May 22, 2007 at 17:08 UTC | |
by Anonymous Monk on May 23, 2007 at 06:04 UTC |