From d7b626f8a4cd30110a86c93ea4fb751c8206a660 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Thu, 23 May 2002 23:07:09 +0000 Subject: [PATCH] Added the Env macro at support center member request. --- lib/WebGUI/Macro/Env.pm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lib/WebGUI/Macro/Env.pm diff --git a/lib/WebGUI/Macro/Env.pm b/lib/WebGUI/Macro/Env.pm new file mode 100644 index 000000000..bd874e090 --- /dev/null +++ b/lib/WebGUI/Macro/Env.pm @@ -0,0 +1,35 @@ +package WebGUI::Macro::Env; + +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2002 Plain Black Software. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +use strict; +use WebGUI::Macro; +use WebGUI::Session; + +#------------------------------------------------------------------- +sub _replacement { + my (@param, $temp); + @param = WebGUI::Macro::getParams($_[0]); + $temp = $session{env}{$param[0]}; + return $temp; +} + +#------------------------------------------------------------------- +sub process { + my ($output, $temp); + $output = $_[0]; + $output =~ s/\^Env\((.*?)\)\;/_replacement($1)/ge; + return $output; +} + +1; + +