NAME

Module::TestConfig::Question - question interface

SYNOPSIS

  use Module::TestConfig::Question;

  my $question = Module::TestConfig::Question->new(
	name => 'toes',
	msg => 'How many toes do you have?',
	def => 10,
	opts => {
		 noecho   => 0,
		 validate => { ... },
		 skip     => sub { ... },
		}
  );

PUBLIC METHODS

new()

Args: See "SYNOPSIS"

Returns: an object

msg()
question()

Required. The question we ask of a user. A string. Tends to look best when there's a '?' or a ':' on the end.

Args: a question to ask the user

Returns: that question

name()

The name an answer is saved as. Basically a hash key.

Args: the question's name

Returns: that name

def()
default()

A question's default answer.

Args: a default

Returns: that default

opts()
options()

See "skip()", "validate()" and "noecho()".

Args: A hash or hashref of options.

Returns: the hashref in scalar context, a hash in list context.

skip()

Criteria used to skip the current question. Either a scalar or a coderef. If either evalutes to true, the current question ought to be skipped.

Args: a scalar or coderef

Returns: the current scalar or coderef

validate()

Args to be passed directly to Params::Validate::validate() or another validation subroutine.

Args: a hashref by default

Returns: the current hashref

noecho()

Do we echo the user's typing?

Args: 1 or 0

Returns: the current value

AUTHOR

Joshua Keroes <jkeroes@eli.net>

COPYRIGHT AND LICENSE

Copyright 2003 by Joshua Keroes <jkeroes@eli.net>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Module::TestConfig