in reply to Testing for the existence of STDIN?
UPDATE:
Actually, you _could_ use a time out with $SIG{ALRM}:
You cannot get finer grained than one second with this way, but you can with select.$SIG{ALRM} = sub { die 'STDIN' }; eval { alarm(1); print while <>; alarm(0); }; print "no STDIN\n" if $@ =~ /STDIN/;
Or .... just use wog's much more elegant solution. wog++
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Testing for the existence of STDIN?
by darkomen (Acolyte) on Jan 24, 2002 at 03:05 UTC |