Professional Web Applications Themes

"stty -echo" replacement for windows - PERL Beginners

Hi I'm writing a script on windows that's intended to run on windows (well, I don't have windows at home so...), and I'm looking for something to replace the "stty -echo" command on linux: print "Password: "; system "stty -echo"; # disable echo chomp (my $pass = <STDIN>); system "stty echo"; # enable echo any ideas? thanx -- Haim...

  1. #1

    Default "stty -echo" replacement for windows

    Hi

    I'm writing a script on windows that's intended to run on windows (well, I
    don't have windows at home so...), and I'm looking for something to replace
    the "stty -echo" command on linux:

    print "Password: ";
    system "stty -echo"; # disable echo
    chomp (my $pass = <STDIN>);
    system "stty echo"; # enable echo

    any ideas?

    thanx
    --
    Haim
    Haim Ashkenazi Guest

  2. #2

    Default Re: "stty -echo" replacement for windows

    Haim Ashkenazi wrote:
    > Hi
    >
    > I'm writing a script on windows that's intended to run on windows (well, I
    this is an error of-course. I'm writing it on linux :)

    > don't have windows at home so...), and I'm looking for something to
    > replace the "stty -echo" command on linux:
    >
    > print "Password: ";
    > system "stty -echo"; # disable echo
    > chomp (my $pass = <STDIN>);
    > system "stty echo"; # enable echo
    >
    > any ideas?
    >
    > thanx
    > --
    > Haim

    Haim Ashkenazi Guest

  3. #3

    Default Re: "stty -echo" replacement for windows

    Haim Ashkenazi wrote:
    >
    > Hi
    Hello,
    > I'm writing a script on windows that's intended to run on windows (well, I
    > don't have windows at home so...), and I'm looking for something to replace
    > the "stty -echo" command on linux:
    >
    > print "Password: ";
    > system "stty -echo"; # disable echo
    > chomp (my $pass = <STDIN>);
    > system "stty echo"; # enable echo
    >
    > any ideas?
    perldoc -q password

    Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
    How do I ask the user for a password?

    (This question has nothing to do with the web. See a
    different FAQ for that.)

    There's an example of this in the crypt entry in the
    perlfunc manpage). First, you put the terminal into "no
    echo" mode, then just read the password normally. You may
    do this with an old-style ioctl() function, POSIX terminal
    control (see the POSIX manpage, and Chapter 7 of the
    Camel), or a call to the stty program, with varying
    degrees of portability.

    You can also do this for most systems using the
    Term::ReadKey module from CPAN, which is easier to use and
    in theory more portable.

    use Term::ReadKey;

    ReadMode('noecho');
    $password = ReadLine(0);


    John
    --
    use Perl;
    program
    fulfillment
    John W. Krahn Guest

  4. #4

    Default Re: "stty -echo" replacement for windows

    John W. Krahn wrote:
    > perldoc -q password
    >
    > Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
    > How do I ask the user for a password?
    >
    > (This question has nothing to do with the web. See a
    > different FAQ for that.)
    >
    > There's an example of this in the crypt entry in the
    > perlfunc manpage). First, you put the terminal into "no
    > echo" mode, then just read the password normally. You may
    > do this with an old-style ioctl() function, POSIX terminal
    > control (see the POSIX manpage, and Chapter 7 of the
    > Camel), or a call to the stty program, with varying
    > degrees of portability.
    >
    > You can also do this for most systems using the
    > Term::ReadKey module from CPAN, which is easier to use and
    > in theory more portable.
    >
    > use Term::ReadKey;
    >
    > ReadMode('noecho');
    > $password = ReadLine(0);
    thanx, I've seen this solution. the problem is that on activeperl (the perl
    I will use in windows, because of the application they have that generate a
    binary with interperter) they don't have Term::ReadKey as a ppm, and we
    don't have a compiler for windows to try and compile it ourselves. anyway
    someone told me that windows machines have an "echo off/on" command so I
    will try to run it and see if it works.

    thanx
    --
    Haim

    Haim Ashkenazi Guest

  5. #5

    Default RE: "stty -echo" replacement for windows

    Suggest you install and use cygwin including its perl package. It
    includes Term::Readkey and the other core packages. I just did a cygwin
    installation on win2k yesterday and it went smoothly. Note that emacs
    and midnight commander are the only default editors, but nano and vim
    are selectable as options.

    -tristram

    -----Original Message-----
    From: Haim Ashkenazi [mailto:haim@babysnakes.org]
    Sent: Monday, October 06, 2003 7:13 PM
    To: [email]beginners@perl.org[/email]
    Subject: Re: "stty -echo" replacement for windows


    John W. Krahn wrote:
    > perldoc -q password
    >
    > Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
    > How do I ask the user for a password?
    >
    > (This question has nothing to do with the web. See a
    > different FAQ for that.)
    >
    > There's an example of this in the crypt entry in the
    > perlfunc manpage). First, you put the terminal into "no
    > echo" mode, then just read the password normally. You may
    > do this with an old-style ioctl() function, POSIX terminal
    > control (see the POSIX manpage, and Chapter 7 of the
    > Camel), or a call to the stty program, with varying
    > degrees of portability.
    >
    > You can also do this for most systems using the
    > Term::ReadKey module from CPAN, which is easier to use and
    > in theory more portable.
    >
    > use Term::ReadKey;
    >
    > ReadMode('noecho');
    > $password = ReadLine(0);
    thanx, I've seen this solution. the problem is that on activeperl (the
    perl I will use in windows, because of the application they have that
    generate a binary with interperter) they don't have Term::ReadKey as a
    ppm, and we don't have a compiler for windows to try and compile it
    ourselves. anyway someone told me that windows machines have an "echo
    off/on" command so I will try to run it and see if it works.

    thanx
    --
    Haim


    --
    To unsubscribe, e-mail: [email]beginners-unsubscribe@perl.org[/email]
    For additional commands, e-mail: [email]beginners-help@perl.org[/email]

    Tn Guest

  6. #6

    Default RE: "stty -echo" replacement for windows

    Tn wrote:
    > Suggest you install and use cygwin including its perl package. It
    > includes Term::Readkey and the other core packages. I just did a cygwin
    > installation on win2k yesterday and it went smoothly. Note that emacs
    > and midnight commander are the only default editors, but nano and vim
    > are selectable as options.
    thanx, but as I said on my previous reply, I need it to be on activestate
    perl (so I can use their "perlapp" application).

    thanx
    --
    Haim
    >
    > -tristram
    >
    > -----Original Message-----
    > From: Haim Ashkenazi [mailto:haim@babysnakes.org]
    > Sent: Monday, October 06, 2003 7:13 PM
    > To: [email]beginners@perl.org[/email]
    > Subject: Re: "stty -echo" replacement for windows
    >
    >
    > John W. Krahn wrote:
    >> perldoc -q password
    >>
    >> Found in /usr/lib/perl5/5.6.0/pod/perlfaq8.pod
    >> How do I ask the user for a password?
    >>
    >> (This question has nothing to do with the web. See a
    >> different FAQ for that.)
    >>
    >> There's an example of this in the crypt entry in the
    >> perlfunc manpage). First, you put the terminal into "no
    >> echo" mode, then just read the password normally. You may
    >> do this with an old-style ioctl() function, POSIX terminal
    >> control (see the POSIX manpage, and Chapter 7 of the
    >> Camel), or a call to the stty program, with varying
    >> degrees of portability.
    >>
    >> You can also do this for most systems using the
    >> Term::ReadKey module from CPAN, which is easier to use and
    >> in theory more portable.
    >>
    >> use Term::ReadKey;
    >>
    >> ReadMode('noecho');
    >> $password = ReadLine(0);
    > thanx, I've seen this solution. the problem is that on activeperl (the
    > perl I will use in windows, because of the application they have that
    > generate a binary with interperter) they don't have Term::ReadKey as a
    > ppm, and we don't have a compiler for windows to try and compile it
    > ourselves. anyway someone told me that windows machines have an "echo
    > off/on" command so I will try to run it and see if it works.
    >
    > thanx
    > --
    > Haim
    >
    >
    Haim Ashkenazi Guest

Similar Threads

  1. Using the "Color Replacement tool" in Photoshop CS
    By Gary_A._Swiech@adobeforums.com in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 7
    Last Post: December 21st, 02:42 AM
  2. Replies: 0
    Last Post: October 19th, 07:36 AM
  3. #39195 [NEW]: if (0=="any sting") echo "it's return true";
    By waynewn at citiz dot net in forum PHP Bugs
    Replies: 0
    Last Post: October 19th, 07:33 AM
  4. #26162 [NEW]: $a="0abcdefg";if ($a==0) echo "OK"; result is "OK" ?!
    By zhuminglun at yahoo dot com dot cn in forum PHP Development
    Replies: 0
    Last Post: November 7th, 12:04 PM
  5. Replies: 0
    Last Post: November 7th, 11:45 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139