| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
Debconf::Element::Teletype::Password - password input field |
| 6 |
|
| 7 |
=cut |
| 8 |
|
| 9 |
package Debconf::Element::Teletype::Password; |
| 10 |
use warnings; |
| 11 |
use strict; |
| 12 |
use base qw(Debconf::Element); |
| 13 |
|
| 14 |
=head1 DESCRIPTION |
| 15 |
|
| 16 |
This is a password input field. |
| 17 |
|
| 18 |
=head1 show |
| 19 |
|
| 20 |
Prompts for a password, without displaying it or echoing keystrokes. |
| 21 |
|
| 22 |
=cut |
| 23 |
|
| 24 |
sub show { |
| 25 |
my $this=shift; |
| 26 |
|
| 27 |
# Display the question's long desc first. |
| 28 |
$this->frontend->display( |
| 29 |
$this->question->extended_description."\n"); |
| 30 |
|
| 31 |
my $default=''; |
| 32 |
$default=$this->question->value if defined $this->question->value; |
| 33 |
|
| 34 |
my $value=$this->frontend->prompt_password( |
| 35 |
prompt => $this->question->description, |
| 36 |
default => $default, |
| 37 |
question => $this->question, |
| 38 |
); |
| 39 |
return unless defined $value; |
| 40 |
|
| 41 |
# Handle defaults. |
| 42 |
if ($value eq '') { |
| 43 |
$value=$default; |
| 44 |
} |
| 45 |
|
| 46 |
$this->frontend->display("\n"); |
| 47 |
$this->value($value); |
| 48 |
} |
| 49 |
|
| 50 |
1 |