Greetings,

  I am new to both Perl (which I like) and also to Unix, although
  I have 25yrs experience in other languages and OSes.

  I am currently converting some DCL scripts from VMS to
  run on TRU64 Unix (on Alphas).

  My Perl version is perl, v5.6.1 built for alpha-dec_osf-ld.

 The script I am having trouble with takes a filestring as a parameter, and
  transfers that file from the host to the users PC. It needs to do this
  unattended (i.e. no interaction from the user).

  This means that it must first determine what Terminal Emulation software
  the user is running (in our case, either Reflection or KEA).

  For KEA, a control sequence of '<ESC>[ 5;1.z'   solicits a response
  of '<DCS>5.yKEAterm<ST>'.

  And for Reflection, '<ESC>[0;1234c' gives a response of 'W02-700L456789'.

  The problems are:
    1. The responses are not terminated by CR or CRLF, so I need a timeout.
    2. I am totally unable to get the responses into a variable so that I
may
        test them. If I have 'echo' turned on for the terminal, then the
responses
        are visible, but I can't capture them into the script.

  I have tried several things, among them being:

  Perl:
        use Term::ReadKey;
            open(TTY, "</dev/tty");
            print "\e[5;1.z";
        #    `sleep 1`;
            ReadMode "raw";
            do {
                $key = ReadKey -1, *TTY;
                if ($key) {$string .= $key;}
            } until (!$key);
            ReadMode "normal";
            print "\nResponse was |$string|\n";
            exit;

KSH:
        echo "Trying KEA..."
        stty -echo
        echo "\033[5;1.z"
        ## sleep 1
        ## echo "\n"
        ##read  hoststseq
        if read | grep -q 'KEA'
        then
          stty echo
          echo "Found KEA"
          exit 3
        else 
          stty echo
          echo "Rats"
          exit 4
        fi
        exit

Would anyone be able to point me in the right direction?

Thank you,
Paul
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to