VariableSet - class representing sets of session variables


Steven J. McDowall <>


Copyright 2002-2011 Applied Testing and Technology, Inc. All Rights Reserved.


use VariableSet;

# create a new VariableSet object
my $variables = new VariableSet;

# read the set from a file
$variables->fromFile( Config::SITE::VariableFile);

The VariableSet object is a handy container object used to track/read/manipulate a suite's variable definitions into a memory data structure.


The format of a variable definition file is a whitespace separated collection of fields, one record per row, with the first row of the file being a definition of the field names. In this case, the fields in the file are:


the name of the variable


the type of the variable: one of text, textbox, single, multiple, derived, or separator


a comma separated list of options for this variable. Flags vary by type, and are documented in the ApTest Manager User's Guide.


the size of the input field when presenting to the user


the prompt to use when asking for a value from the user


a comma separated list of potential values for this variable (if it is a single or multiple), and a default value to use for text or textbox. If it is a comma separated list, items starting with an asterisk are "defaults" for the item.


new - create a new, unpopulated variable set object

$set = new VariableSet(fileName);

Creates a new VariableSet object, optionally reading in the base definition from a file.

returns a reference to the VariableSet object.

release - release the variable set


toFile - output the "compiled" variable set structure

$set->toFile( filename ) ;

print - print the contents of the variable set


fromFile - read in the variable definitions from a file..


loadAccountDefaults - reads in, evals, and sets default values from a file.

$set->loadAccountDefaults( vendor ) ;

addHeader - adds a new header

Adds a new header entry into the set and marks it as the current header for future variable adds.

$set->addHeader( $id, $title) ;

$id - the title identifer

$title - the text to display

addVariable - add a new variable

Adds a new variable to the set.

$set->addVariable( $varRef );

$varRef - a reference to a Variable object.

currentHeader - return the current variable header

my $header = $set->currentHeader();

getVarByName - find and return a Variable object given its id

my $var = $set->getVarByName( $id ) ;

countVars - count the number of variables

my $count = $set->countVars();

countHeaders - count the number of headers

my $count = $set->countHeaders();

countSessionVars - count the number of session variables

my $count = $set->countSessionVars();

getVarHash - get the hash of Variable objects

my $hash = $set->getVarHash();

getHeaderArray - get an arrayref of headers

my $headers = $set->getHeaderArray();

sessionVarList - get a list of variables

my $list = $set->sessionVarList();

suiteDir - accessor for test suite root

my $dir = $set->suiteDir();
$set->suiteDir( $suite );

Gets/sets the path to the test suite data root.

visibleList - return a list of visible fields

@vlist = $vars->visibleList( [$includeSpecials [, sortIt] ] ) ;

includeSpecials is a boolean that defaults to false. If true, then the reserved atm special session variables are also included.

sortit is a boolean that indicates whether the results should be alphabetically sorted or not. The default is to NOT sort the results.

javaScriptDependencies - set up depends for JS functions

$jsInit = $set->javaScriptDependencies(showMandatory);

showMandatory is a boolean indicating whether to show which fields are mandatory or not. Defaults to true.

Returns a set of javascript declarations that match the dependencies among fields in a session.



VariableSet::Header - class representing section headers


new - create a new VariableSet::Header object

my $header = VariableSet::Header->new( $id, $title );

id - get the header ID

my $id = $header->id();

title - get the header title

my $title = $header->title();

variableList - get the list of variables under a header

my $list = $header->variableList();

Copyright © 2000-2013 Applied Testing and Technology, Inc. All rights reserved.