Index: /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
===================================================================
--- /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 9897)
+++ /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 9898)
@@ -1,5 +1,5 @@
 # Copyright (c) 2006  Paul Price, Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.3 2006-11-07 03:18:39 price Exp $
+# $Id: Config.pm,v 1.4 2006-11-07 22:56:41 price Exp $
 
 package PS::IPP::Config;
@@ -42,8 +42,10 @@
     my $mdc = $parser->parse( join '', @contents); # The parsed metadata config
 
-    my $path = _mdLookupStr($mdc, 'PATH'); # The path
-    my $workdir = _mdLookupStr($mdc, 'WORKDIR'); # The working directory
+    my $path = _interpolate_env(_mdLookupStr($mdc, 'PATH')); # The path
+    my $workdir = _interpolate_env(_mdLookupStr($mdc, 'WORKDIR')); # The working directory
     croak "PATH is not set in $name\n" unless defined $path;
     croak "WORKDIR is not set in $name\n" unless defined $workdir;
+
+    # Interpolate environment variables in the work directory
 
     my $self = {
@@ -182,4 +184,22 @@
 
 
+# Interpolate environment variables in a directory (or colon-delimited list of directories)
+sub _interpolate_env
+{
+    my $dir = shift;		# Directory of interest
+
+    return undef unless defined $dir;
+
+    print "Checking $dir\n";
+
+    while ($dir =~ /\$\{?(\w*)[\}\/:]?/) {
+	my $name = $1;		# Environment variable name
+	my $value = $ENV{$name}; # Environment variable value
+	print "Replacing $name with $value.\n";
+	$dir =~ s/\$\{?$name\}?/$value\//;
+    }
+    return $dir;
+}
+
 # Lookup the metadata, checking the type is STR
 sub _mdLookupStr
