D
David Vincelli
------=_Part_13322_3417944.1116105604111
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
here's a summary of a script I just wrote:
while (true) do
puts "Make your selection from the list below: \n\n"
puts "a) foo\n"
puts "b) bar\n\n"
gets
handle_action($_)
end
handle_action does stuff that isn't relevant to my question.
The program works fine except when I hit CTRL-D. After I hit CTRL-D, the=20
program runs in an endless loop and seems to skip over the gets statement.=
=20
Doesn't look good, I can't even break out of it (CTRL-C). Of course CTRL-D=
=20
indicates end of file. My guess is that this closes STDIN.
I just thought of a "work around", consisting of inserting
exit unless $_
after the gets statement
I think it might be better to simply re-open STDIN as if nothing had=20
happened.. is this a good idea and is it possible?
Thanks,
--=20
David Vincelli
------=_Part_13322_3417944.1116105604111--
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
here's a summary of a script I just wrote:
while (true) do
puts "Make your selection from the list below: \n\n"
puts "a) foo\n"
puts "b) bar\n\n"
gets
handle_action($_)
end
handle_action does stuff that isn't relevant to my question.
The program works fine except when I hit CTRL-D. After I hit CTRL-D, the=20
program runs in an endless loop and seems to skip over the gets statement.=
=20
Doesn't look good, I can't even break out of it (CTRL-C). Of course CTRL-D=
=20
indicates end of file. My guess is that this closes STDIN.
I just thought of a "work around", consisting of inserting
exit unless $_
after the gets statement
I think it might be better to simply re-open STDIN as if nothing had=20
happened.. is this a good idea and is it possible?
Thanks,
--=20
David Vincelli
------=_Part_13322_3417944.1116105604111--