Well, I may have found The Right Way to accomplish my timed reads. Term::ReadKey has a ReadKey() function (exported by default) that accepts a timeout and returns a first keystroke or undef if the timeout occurs. So I can write a timed_read() routine around it which goes ahead and reads until $/ with <>, prepends the first character, and moves on.
I've already got a routine with IO::Select, but it appears to not be working sometimes, and I don't know why. Sometimes it times out when the input should be there. I'll implement the ReadKey() version and see if it makes a difference.
Of course, when I discovered ReadKey() gave me what I needed, I looked to see how it was implemented. The answer was that the author checks far more things about the system than I knew existed and then eval's one of many ReadKey() definitions into existence. Wow! Talk about a motivator for calling a module instead of cut-and-paste.
I'm doing all this over sockets, through inetd, just to be difficult, you know.
user run inetd (Score:1)
%
So long as the port you are using isn't below 1024 there shouldn't be any problem.
BTW, if your sysadmin notices two copies of inetd running, she may start getting confused, so it's probably an idea to let her know what you're doing even though it's perfectly reasonable.
-Dom
Re:user run inetd (Score:2)
BTW, if your sysadmin notices two copies of inetd running, she may start getting confused, so it's probably an idea to let her know what you're doing even though it's perfectly reasonable.
Yep. That's another advantage of the wrapper script. :)
I think I did the personally run inetd a couple of years back, but the wrapper I've written with the DummyInetd module makes it easier because I don't have to do any setup. It's just ./inetd path/to/program. Also, don't you still have to configure /etc/servic
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers