env — provides read-only access to the HTTP environment variables


Attribute Pos. Req. Default Description
arg | name Yes     Name of the environment variable to display, if any.
interpolate     0 interpolate output?
hide     0 Hide the tag return value?


The [env] tag provides read-only access to the HTTP environment variables. It can both display a specific variable as-is, or produce a complete list of variables and values in a simple HTML table.

List display is useful for simple debugging or diagnostics.


This tag does not appear to be affected by, or affect, the rest of Interchange.


Example: Display the client connection and browser information

The client's remote address and port are kept in REMOTE_ADDR and REMOTE_PORT variables. User's browser ID string is kept in HTTP_USER_AGENT.

Client connection: [env REMOTE_ADDR]:[env name="REMOTE_PORT"]<br/>
Client browser: [env arg="HTTP_USER_AGENT"]

Example: Display the simple HTML table with the complete HTTP environment

HTTP environment: <br/>



env is available in Interchange versions:

4.6.0-5.9.0 (git-head)


Interchange 5.9.0:

Source: code/UserTag/env.tag
Lines: 33

# Copyright 2004-2007 Interchange Development Group and others
# Copyright 2001 Ed LaFrance <>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# $Id: env.tag,v 1.11 2007-03-30 23:40:57 pajamian Exp $

Usertag env Order      arg
Usertag env PosNumber  1
UserTag env attrAlias  name arg
UserTag env Version    $Revision: 1.11 $
Usertag env Routine    <<EOR
sub {
my $arg = shift;
my $env = ::http()->{env};
my $out;
if (! $arg) {
  $out = "<table cellpadding='2' cellspacing='1' border='1'>\n";
  foreach ((keys %$env)) {
    $out .= "<tr><td><b>$_</b></td><td>";
    $out .= "$env->{$_}</td>\n</tr><tr>\n";
  $out .= "</table>\n";
else {
  $out = $env->{$arg};
return $out;


Ed LaFrance, Interchange Development Group


var(7ic), button(7ic)

DocBook! Interchange!