Reading input from the STDIN through console

  • Subba Reddy  Madireddygari

    I am using Eclispe 3.4 - EPIC 0.6.24 on WinXP machine.
    I was able to run the perl script from Eclipse
    and was able to user entered the data when it prompts to read input from (Eclipse console) on using $pwd=<STDIN>;
    But, following is not working since, trying to use the stty -noecho concept for password reading.
    use Term::ReadKey;
        ReadMode 'noecho';
        my $password = ReadLine 0;
        chomp ($password);    # Removes all CR and LF from the end of the line.
        ReadMode 'normal';
        return $password;

    • Subba Reddy  Madireddygari

      Whereas, if I run from command prompt, it will work.
      But, its working not in Eclipse console and giving following error.

      Enter your cws password: GetConsoleMode failed, LastError=|6| at C:/Perl/lib/Term/ line 264.
      #!c:/perl/bin/perl -w
      $|=1; # make STDOUT unbuffered
      use Term::ReadKey;
      print "Enter your cws password: ";
      my $pwd = &_password();

      sub _password() {
      ReadMode 'noecho'; 
      my $password = ReadLine 0; 
      chomp ($password); # Removes all CR and LF from the end of the line. 
      ReadMode 'normal'; 
      return $password;


      Though, I am not sure to post this issue in the Eclispe forum or EPIC forum?

      Thanks for any help.

      ~ Subba

      • Jan Ploski

        Jan Ploski - 2008-07-25

        When you run a script in Eclipse, it is a forked process and the communication between the Eclipse console and the Perl process occurs durign stdout/stderr/stdin streams. There is no terminal to be controlled.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks