Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that lists all instances of an application program, allow me to select which to kill and restart. The script works fine when executed on my laptop(Win2000/ActivePerl)on DOS prompt. The program basically prompt for user for a command,either list, kill or restart. When I try to run remotely on another windows 2000 machine over remote desktop, it behaves weird. The script freeze after accepting the list command which basically output from open <RESULT>, "ps -W|"; and my grep sub that filters out only the instances of the application program of interest. Subsequent typing doesn't appear on the screen. Any help is appreciated.

Replies are listed 'Best First'.
Re: Perl script freeze in RDS
by tlm (Prior) on May 06, 2005 at 04:22 UTC

    It would help if you posted the relevant portion of the code that is giving you problems.

    the lowliest monk

      Hi,

      I think this is Louis posting a question. He was asking about something very similar in the chatterbox yesterday.
      The code he had at the time is still posted in his scratchpad, however I think he slightly changed how $input was assigned.

      marto
Re: Perl script freeze in RDS
by K_M_McMahon (Hermit) on May 06, 2005 at 04:21 UTC
    Can you post the code for us to look over?

    -Kevin
    my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}
Re: Perl script freeze in RDS
by Anonymous Monk on May 12, 2005 at 07:53 UTC
    Sorry guys. I was sidetrack by other issues and didn't have a chance to follow up. Here's more details of the problem:- i) The script runs fine on my laptop. It allows me to list all instances of a praticular application program running on the system. User can then select a particular process to kill or restart. These are done using basically by calling the system command such as "ps -W", "kill -f pid". ii) When I run the script on a remote machine inside a DOS shell through remote desktop session, I can only issue the 'list' command to list all the instances of a particular application program. The script will then freeze refusing any input from keyboard. I repeat this doesn't happen if I run the script on a local machine. I wonder if this problem is related to the use of remote desktop. I would appreciate if someone who has experience running perl script over a remote desktop experience to shed some light on how a text mode interactive script should read the keyboard input. I suspect simply <STDIN> is not working over a remote desktop session.