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

I m using a perl environment with win32:guitest pkg to test a GUI. All these GUI test functions are made as few subroutines and are available in a pkg. I m using this pkg in each of my testcases which are again perl files. I call this test file with a pipe like "perl -X test.pl | tee transcript". The intention of piping is to capture the log in a file as well as display in std out. One of my subroutines have a win32:guitest function "IsKeyPressed", which will check whether the particular key is pressed and return true or false dependingly. This expects keyboard input. When i run the perl script as mentioned above, this function fails, meaning the key press is not recognised. but if i run without 'tee' command like "perl -X test.pl", it works as expected. Also i ve $| set to '1'. Can anyone help me out.
  • Comment on IsKeyPressed not properly working with 'tee' command

Replies are listed 'Best First'.
Re: IsKeyPressed not properly working with 'tee' command
by cdarke (Prior) on Jul 19, 2007 at 08:46 UTC
    'tee' is not a normal Windows command, and I'm not sure what you mean by "a perl environment". From your description - it fails with tee but works without - don't you think the 'tee' program is the problem? You might be better served asking whoever supplied the 'tee' command.
    $| (unless you changed the default file handle) should only affect output, not input.
Re: IsKeyPressed not properly working with 'tee' command
by thiagu_comp (Initiate) on Jul 19, 2007 at 12:34 UTC
    Hi, By perl environment i meant all the perl related files, pkgs that are used for the testing. 'tee' is an unix command. i m using cygwin to run unix commands and perl scripts in windows machine. 'tee' has no problem with other unix commands like "ls \ | tee transcript".
      In that case I would ask the cygwin people if I were you. My guess is that cygwin is probably taking control of the keyboard for the duration of the pipe - you would not notice that with ls.