Reading input from the STDIN through console
msubbareddy wrote on Fri Jul 25 22:24:58 MEST 2008:
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=; 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;
msubbareddy wrote on Fri Jul 25 22:30:55 MEST 2008:
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/ReadKey.pm
line 264.
[code]
#!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;
}
[/code]
Though, I am not sure to post this issue in the Eclispe forum or EPIC forum?
Thanks for any help.
~ Subba
jploski wrote on Fri Jul 25 23:57:35 MEST 2008:
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.
Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.