Name

Variable — define an Interchange variable

SYNOPSIS

NAME value

DESCRIPTION

The directive defines a variable that will be available either globally (if defined in interchange.cfg) or within a catalog (if defined in catalog.cfg).

Variable names are case sensitive and can only contain word characters (that is, a-z, A-Z, 0-9 and _).

Once the variable is defined, it can be accessed using the following syntax:

  • __NAME__ - to only look for a catalog variable

  • @@NAME@@ - to only look for a global variable

  • @_NAME_@ - to first look for a catalog variable, falling back to global unless found

  • Using the [var] tag (Note: the [var] tag is parsed together with all other tags, unlike the previous methods which are parsed separately, before ITL tag processing takes place)

DIRECTIVE TYPE AND DEFAULT VALUE

Global directive,
Catalog directive

EXAMPLES

Example: Defining a variable

Variable EMAIL root@mydomain.local

Example: Defining a variable

Variable DOCUMENT_ROOT /usr/local/etc/httpd/htdocs

NOTES

Variable names do not need to begin with a capital letter (unlike the documentation prior to Interchange 5.4 release stated), even though specifying them in all-uppercase is a widely accepted practice.

AVAILABILITY

Variable is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: lib/Vend/Config.pm
Line 513

['Variable',       'variable',        ''],

Source: lib/Vend/Config.pm
Line 556

['Variable',       'variable',        ''],

Source: lib/Vend/Config.pm
Line 5295 (context shows lines 5295-5317)

sub parse_variable {
my ($var, $value) = @_;
my ($c, $name, $param);

# Allow certain catalogs global subs
unless (defined $value and $value) { 
  $c = { 'save' => {} };
  return $c;
}

if(defined $C) {
  $c = $C->{$var};
}
else {
  no strict 'refs';
  $c = ${"Global::$var"};
}

($name, $param) = split /\s+/, $value, 2;
chomp $param;
$c->{$name} = $param;
return $c;
}

AUTHORS

Interchange Development Group

SEE ALSO

var(7ic), VariableDatabase(7ic), Member(7ic)

DocBook! Interchange!