Commits

Palmer, 2E0EOL committed 39f7bc8

Simple option string test.

Comments (0)

Files changed (1)

 # Mappings between option types and functions to validate them
 my %OptTypeFuncs = (
 	OPT_TYPE_VARNAME() => \&_CheckOptTypeVarname,
-	OPT_TYPE_STRING() => undef,
+	OPT_TYPE_STRING() => \&_CheckOptTypeString,
 	OPT_TYPE_BOOL() => \&_CheckOptTypeBool,
 	OPT_TYPE_CODEREF() => undef,
 	OPT_TYPE_REALFILE() => \&_CheckOptTypeRealfile,
 	return $good;
 }
 #----------------------------------------------------------------------------
+sub _CheckOptTypeString
+{
+	my ( $self, $OptVal, $PErrMsg ) = @_;
+	die 'Internal error' if ( !$self );
+	return 1 if ( defined($OptVal) && length($OptVal) );
+	$$PErrMsg = 'No string passed'
+		if ( $PErrMsg );
+	return 0;
+}
+#----------------------------------------------------------------------------
 sub _CheckOptTypeRealdir
 {
 	my $self = shift;