Author: spadkins
Date: Fri Apr  2 03:03:24 2010
New Revision: 13881

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

Log:
make App::Options work with mod_perl when perl_restart set by ignoring 
perl_restart in that case

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   Fri Apr  2 03:03:24 2010
@@ -585,7 +585,7 @@
     else {
         print STDERR "5. Skip Option File Processing\n" if ($debug_options);
     }
-    if ($values->{perl_restart} && !$ENV{PERL_RESTART}) {
+    if ($values->{perl_restart} && !$ENV{MOD_PERL} && !$ENV{PERL_RESTART}) {
         $ENV{PERL_RESTART} = 1;
         exec($^X, $0, @{$self->{argv}});
     }
@@ -1035,6 +1035,7 @@
     my ($option_file, $exclude_section, $option, $var, @env_vars, $env_var, 
$value, $regexp);
     my ($cond, @cond, $exclude, $heredoc_end);
     my $debug_options = $values->{debug_options} || 0;
+    my $is_mod_perl = $ENV{MOD_PERL};
     while ($#$option_files > -1) {
         $option_file = shift(@$option_files);
         if ($option_file =~ m!\$\{prefix\}!) {
@@ -1119,11 +1120,13 @@
                     $var = $1;
                     $value = $2;
 
-                    if ($var eq "perl_restart" && $value && $value ne "1") {
-                        foreach my $env_var (split(/,/,$value)) {
-                            if (!$ENV{$env_var}) {
-                                $value = 1;
-                                last;
+                    if (!$is_mod_perl) {
+                        if ($var eq "perl_restart" && $value && $value ne "1") 
{
+                            foreach my $env_var (split(/,/,$value)) {
+                                if (!$ENV{$env_var}) {
+                                    $value = 1;
+                                    last;
+                                }
                             }
                         }
                     }

Reply via email to