Quizzer::Element::Dialog::Password - A password input field in a dialog box


Quizzer documentation Contained in the Quizzer distribution.

Index


Code Index:

NAME

Top

Quizzer::Element::Dialog::Password - A password input field in a dialog box

DESCRIPTION

Top

This is an input element that can display a dialog box with a password input field on it.


Quizzer documentation Contained in the Quizzer distribution.
#!/usr/bin/perl -w

package Quizzer::Element::Dialog::Password;
use strict;
use Quizzer::Element;
use vars qw(@ISA);
@ISA=qw(Quizzer::Element);

my $VERSION='0.01';

sub show {
	my $this=shift;
	
	my ($text, $lines, $columns)=
		$this->frontend->makeprompt($this->question);

	my @params=('--passwordbox', $text,
		$lines + $this->frontend->spacer, $columns);

	my $ret=$this->frontend->showdialog(@params);

	# The password isn't passed in, so if nothing is entered,
	# use the default.
	if (! defined $ret || $ret eq '') {
		my $default='';
		$default=$this->question->value
			if defined $this->question->value;
		return $default
	}
	else {
		return $ret;
	}
}

1