[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Supressing display of passwords



At 03.57 +1030 1999.11.29, Henry Penninkilampi wrote:
>>>Works like a charm - providing the user doesn't make (or try to
>>>correct) a typo.
>>
>>If you take out the if /\w/ part, then you can accept and process
>>backspaces properly.
>
><tests>  Well, how about that - it does too!

Well, I was kinda wrong.  See below.


>MPPE 297: "...[raw mode] turns off echoing and interpretation of
>characters.  In raw mode, a Perl program sees all characters entered,
>including backspace or delete characters and RETURN, as if they were part
>of the input!" -- This led me to think that if the user typed 'a' then
>'delete' then 'c' that the string would contain "a\bc" and not merely
>'c', and probably wouldn't match in subsequent tests.

It actually does.  When you print it back out, it only ends up as "c".  Try:

  if ($char =~ /\w/)   { $pass .= $char; }
  elsif ($char eq "\b"){ chop $pass      }  # handle backspace

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org