[svn:p5ee] r12167 - in p5ee/trunk/App-Options: . lib/App

[email protected] Mon, 15 Dec 2008 20:09:29 -0800 (PST)
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Mon Dec 15 20:09:28 2008
New Revision: 12167

Modified:
   p5ee/trunk/App-Options/CHANGES
   p5ee/trunk/App-Options/lib/App/Options.pm

Log:
fix substitutions of ${prefix} in option files based on assumed prefix

Modified: p5ee/trunk/App-Options/CHANGES
==============================================================================
--- p5ee/trunk/App-Options/CHANGES	(original)
+++ p5ee/trunk/App-Options/CHANGES	Mon Dec 15 20:09:28 2008
@@ -2,6 +2,10 @@
 # CHANGE LOG
 #############################################################################
 
+VERSION 1.05
+ x Substitutions of ${prefix} in option files now works even if only defined by assumption
+   This is particularly valuable for portability between environments of CGI scripts and cron scripts.
+
 VERSION 1.04
  x Fixed RT Bug #33597: Problem of ignoring drive letter on Win32 filesystem.
 

Modified: p5ee/trunk/App-Options/lib/App/Options.pm
==============================================================================
--- p5ee/trunk/App-Options/lib/App/Options.pm	(original)
+++ p5ee/trunk/App-Options/lib/App/Options.pm	Mon Dec 15 20:09:28 2008
@@ -14,7 +14,7 @@
 use File::Spec;
 use Config;
 
-$VERSION = "1.04";
+$VERSION = "1.05";
 
 =head1 NAME
 
@@ -1178,7 +1178,7 @@
                         # do variable substitutions, var = ${prefix}/bin, var = $ENV{PATH}
                         if (defined $value) {
                             if ($value =~ /\{.*\}/) {
-                                $value =~ s/\$\{([a-zA-Z0-9_\.-]+)\}/(defined $values->{$1} ? $values->{$1} : "")/eg;
+                                $value =~ s/\$\{([a-zA-Z0-9_\.-]+)\}/(defined $values->{$1} ? $values->{$1} : ($1 eq "prefix" ? $prefix : ""))/eg;
                                 $value =~ s/\$ENV\{([a-zA-Z0-9_\.-]+)\}/(defined $ENV{$1} ? $ENV{$1} : "")/eg;
                                 print STDERR "         File Var Underwent Substitutions : [$var] = [$value]\n"
                                     if ($debug_options >= 4);