Hi,

        Yesterday I sent an email attaching a patch for what i thought it could 
be a 
bug in Apache::Reload. I attached the wrong patch, so here it is the proper 
one.

Previous mail:
-----------------
First of all thank you very much for maintaining Apache::Reload. We want to 
use it in our project [0] to avoid restarting apache when upgrading our 
modules running under mod_perl. Everything works ok and gets reloaded 
properly when modifying files except for the following case:

        - Module A uses symbols exported by Module B
        - Module A is located before than B in %INC when iterating.
        - Module A and B have changed and A uses new symbols exported by B

        When that happens we got an error when Apache::Reload tries to 
recompile A having the old B symbols still  in memory and it can't found the 
new symbol.

        I don't know if this is the expected behavior and I misunderstood 
everything or maybe I'm using the wrong module and it's totally deprecated.

        Anyway, I've written a small patch to workaround this problem. 
Basically, it removes all the modified modules before reloading them. Instead 
of doing a remove/reload per module.

        The patch is attached.
        
        Thank you very much again for your work and your time.
-- 
Javier Uruen Val - Systems Developer
Warp Networks, S.L - Mobile: 685 876 026
diff -Naur Apache-Reload-0.07/Reload.pm Apache-Reload-0.07-new/Reload.pm
--- Apache-Reload-0.07/Reload.pm	2001-04-22 20:09:59.000000000 +0200
+++ Apache-Reload-0.07-new/Reload.pm	2006-01-13 11:46:16.000000000 +0100
@@ -101,6 +101,7 @@
     }
     
     
+    my @changed;
     while (my($key, $file) = each %Apache::Reload::INCS) {
         local $^W;
         warn "Apache::Reload: Checking mtime of $key\n" if $DEBUG;
@@ -123,19 +124,24 @@
         
         if ($mtime > $Stat{$file}) {
             delete $INC{$key};
- #           warn "Reloading $key\n";
-            if (my $symref = $UndefFields{$key}) {
-#                warn "undeffing fields\n";
-                no strict 'refs';
-                undef %{$symref};
-            }
-            require $key;
-            warn("Apache::Reload: process $$ reloading $key\n")
-                    if $DEBUG;
+	    push @changed, $key;
         }
         $Stat{$file} = $mtime;
     }
     
+    for my $key (@changed) {
+#           warn "Reloading $key\n"; 
+	    if (my $symref = $UndefFields{$key}) {
+#                warn "undeffing fields\n";
+		    no strict 'refs';
+		    undef %{$symref};
+	    }
+	    require $key;
+	    warn("Apache::Reload: process $$ reloading $key\n")
+		    if $DEBUG;
+
+    }
+
     return 1;
 }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to