Changeset 9898 for trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
- Timestamp:
- Nov 7, 2006, 12:56:41 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
r9870 r9898 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1. 3 2006-11-07 03:18:39price Exp $3 # $Id: Config.pm,v 1.4 2006-11-07 22:56:41 price Exp $ 4 4 5 5 package PS::IPP::Config; … … 42 42 my $mdc = $parser->parse( join '', @contents); # The parsed metadata config 43 43 44 my $path = _ mdLookupStr($mdc, 'PATH'); # The path45 my $workdir = _ mdLookupStr($mdc, 'WORKDIR'); # The working directory44 my $path = _interpolate_env(_mdLookupStr($mdc, 'PATH')); # The path 45 my $workdir = _interpolate_env(_mdLookupStr($mdc, 'WORKDIR')); # The working directory 46 46 croak "PATH is not set in $name\n" unless defined $path; 47 47 croak "WORKDIR is not set in $name\n" unless defined $workdir; 48 49 # Interpolate environment variables in the work directory 48 50 49 51 my $self = { … … 182 184 183 185 186 # Interpolate environment variables in a directory (or colon-delimited list of directories) 187 sub _interpolate_env 188 { 189 my $dir = shift; # Directory of interest 190 191 return undef unless defined $dir; 192 193 print "Checking $dir\n"; 194 195 while ($dir =~ /\$\{?(\w*)[\}\/:]?/) { 196 my $name = $1; # Environment variable name 197 my $value = $ENV{$name}; # Environment variable value 198 print "Replacing $name with $value.\n"; 199 $dir =~ s/\$\{?$name\}?/$value\//; 200 } 201 return $dir; 202 } 203 184 204 # Lookup the metadata, checking the type is STR 185 205 sub _mdLookupStr
Note:
See TracChangeset
for help on using the changeset viewer.
