[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: perl script run by inetd ??



In article <[🔎] Pine.GSO.3.95.980927020529.27709C-100000@panther.Gsu.EDU>,
Jerry Yu Z. <gs01zyu@panther.Gsu.EDU> wrote:
>local $EOL = "\015\012";
>        print "Welcome ; type help for command list.$EOL";
>        print "Command?$EOL";
>        while (<STDIN>) {
>        chop;
>        print;
>       }
>
>greet all,
>the above perl snipet is configured to be run by inetd at port 9100. If I
>do a 'telnet localhost(or its IP) 9100. I will enter a weird mode: I can
>enter anything, without any repsonse.

Use "$| = 1;" at the start of your script to turn off output
buffering.

>Actually I can't terminate the input
>mode by ctrl-D or whatever but 'kill -TERM $PID'. 

Ctrl-D only works on a tty, not on a socket. Use something like
"last if (/^quit$/i);" in the main loop so entering "quit" will
exit the program.

Mike.
-- 
  "Did I ever tell you about the illusion of free will?"
    -- Sheriff Lucas Buck, ultimate BOFH.


Reply to: