On Tuesday, June 11, 2002, at 01:31 , learn perl wrote:

> here's my code
>
> #code begins#
> $i=-1;
> do{
>     $i++;
>     print 'please enter password: ';
>     chomp($input=<STDIN>);
> }until (!$i);
>
> #end code#


the do{...}until is not really useful unless you were planning to
check.... the old dog perl standard trick we have all used for
*nix tricks works like:

#-------------------------
# OK - so the perldoc says rip this off and use it
# so I did - it will get me the dope I need

sub gbc {

     my($realm) = @_;
        my ($user, $password) = ( undef, undef);
     if(-t) {
                        # are we attached to a tty???
             print "Enter username for $realm: ";
             chomp($user = <STDIN>);
                        return (undef, undef) unless length $user;
                        # you may want only this part, and hence
                        # to trim it a bit more
             print "Password: ";
             system("stty -echo");
             chomp($password = <STDIN>);
             system("stty echo");
             print "\n";  # because we disabled echo    }

     return ($user, $password);

        
} # end gbc - the get_basic_credentials



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to