VarName — remap Interchange variables to arbitrary names in generated URLs
The directive sets the names of variables that will be remapped to and from the URL when Interchange outputs it in user pages or reads from form submission requests.
Interchange already ships with some remapping definitions (to shorten URLs, not
obfuscate code or anything); see etc/varnames
for a
list.
When remapping mv_
variable names, make sure you avoid
two-letter abbreviations — most are reserved for the
search parameters. Names consisting of
1, 3 or more characters would be fine, though.
Interchange 5.9.0:
Source: lib/Vend/Config.pm
Line 2874 (context shows lines 2874-2911)
sub parse_varname { my($item,$settings) = @_; return if $Vend::ExternalProgram; my($iv,$vn,$k,$v,@set); #logDebug("parse_varname: $settings"); if(defined $C) { return '' if ! $settings; $C->{IV} = { %{$Global::IV} } if ! $C->{IV}; $C->{VN} = { %{$Global::VN} } if ! $C->{VN}; $iv = $C->{IV}; $vn = $C->{VN}; } else { if (! $Global::VarName) { unless (-s "$Global::ConfDir/varnames" && -r _) { $settings = $Varnames . "\n$settings"; writefile("$Global::ConfDir/varnames", $Varnames); } else { $settings = readfile("$Global::ConfDir/varnames"); } } undef $Varnames; $Global::IV = {} if ! $Global::IV; $Global::VN = {} if ! $Global::VN; $iv = $Global::IV; $vn = $Global::VN; } @set = grep /\S/, split /\s+/, $settings; while( $k = shift @set, $v = shift @set ) { $vn->{$k} = $v; $iv->{$v} = $k; } return 1; }