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

Re: [MacPerl] Supressing display of passwords



On 19991129 0430, Chris Nandor wrote:

>>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

Right.  That's virtually the same as I had it before - except that it 
short-circuits more efficiently.

I, and probably a lot of other folks, print variables to the screen 
extensively just to 'sanity check' the data that is flowing though the 
code.  This is the first time that I can remember my gut instinct being 
right, and my eyes being wrong.  A good lesson to learn.

Henry.

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