Gary Stainburn wrote: > > Hi all, Hello,
> I've got a project where I need to develop an single-board-computer based > network device using packet modems connected to Amateur Radio equipment and > I'm trying to develop a simulator in Perl under Linux and I've got a few > questions. > > Basically I'm going to have X number of nodes running inside Xterm sessions, > all sitting in the same working directory and simulating transmitting data by > appending the data to a file. Each program will simulate receiving the data, > by doing the equivelent of a tail -f on this file. > > Keyboard input will be used to simulate data being received from the box's > serial port. > > 1) How can I simulate the 'tail -f' under perl without hanging my program. perldoc -q "tail -f" Have you thought about writting to a FIFO (named pipe) instead of appending to a file? man perlipc man mkfifo > If I pseudo code it it may give a better idea of what I mean. > > // in main code > > if ($command=&getcommand()) { > &do_something($command); > } > > sub getcommand() { > if character available > add character to buffer > if character = end.of.packet > return buffer > else > return false > } > > 2) can this same method be used to get the characters from the keyboard. Perl has a curses module that may help with this and #4 man Curses > 3) can I reduce the priority of these programs (equivelent of the unix 'nice' > command) from within the perl script or do I need to do it from the shell > script calling the program. (If I nice -> xterm -> perl script, will the nice > still affect the perl script or will I have to do xterm -> nice -> perl > script)? The owner of a process can lower its priority but it can't raise it. system "renice +2 $$"; > 4) Is there an easy way (or a hard way) within Perl to control the xterm > output, something similar to GotoXY that I used to have in TurboPascal in the > good old (?) DOS days. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]