VariableSet |
![]() |
VariableSet - class representing sets of session variables
Steven J. McDowall <sjm@aptest.com>
Copyright 2002-2009 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:
$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.
$set->release();
$set->toFile( filename ) ;
$set->print();
$set->fromFile(fileName);
$set->loadAccountDefaults( vendor ) ;
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
Adds a new variable to the set.
$set->addVariable( $varRef );
$varRef - a reference to a Variable object.
my $header = $set->currentHeader();
my $var = $set->getVarByName( $id ) ;
my $count = $set->countVars();
my $count = $set->countHeaders();
my $count = $set->countSessionVars();
my $hash = $set->getVarHash();
my $headers = $set->getHeaderArray();
my $list = $set->sessionVarList();
my $dir = $set->suiteDir();
$set->suiteDir( $suite );
Gets/sets the path to the test suite data root.
@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.
$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
my $header = VariableSet::Header->new( $id, $title );
my $id = $header->id();
my $title = $header->title();
my $list = $header->variableList();
Copyright © 2000-2008 Applied Testing and Technology, Inc. All rights reserved.