You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ph...@apache.org on 2007/05/10 09:15:24 UTC

svn commit: r536762 - in /perl/Apache-Reload/trunk: Changes lib/Apache/Reload.pm

Author: phred
Date: Thu May 10 00:15:24 2007
New Revision: 536762

URL: http://svn.apache.org/viewvc?view=rev&rev=536762
Log:
Remove modules before reloading them to avoid errors where Apache::Reload tries
to recompile package A having the old package B symbols still in memory.
Submitted by Javier Ureuen Val
Reviewed by Fred Moyer

Modified:
    perl/Apache-Reload/trunk/Changes
    perl/Apache-Reload/trunk/lib/Apache/Reload.pm

Modified: perl/Apache-Reload/trunk/Changes
URL: http://svn.apache.org/viewvc/perl/Apache-Reload/trunk/Changes?view=diff&rev=536762&r1=536761&r2=536762
==============================================================================
--- perl/Apache-Reload/trunk/Changes (original)
+++ perl/Apache-Reload/trunk/Changes Thu May 10 00:15:24 2007
@@ -8,6 +8,9 @@
 
 =item 0.08-dev
 
+Remove modified modules before reloading them
+[Javier Ureuen Val]
+
 Imported from v0.07 into ASF SVN
 [Philip M. Gollucci <pg...@p6m7g8.com>]
 

Modified: perl/Apache-Reload/trunk/lib/Apache/Reload.pm
URL: http://svn.apache.org/viewvc/perl/Apache-Reload/trunk/lib/Apache/Reload.pm?view=diff&rev=536762&r1=536761&r2=536762
==============================================================================
--- perl/Apache-Reload/trunk/lib/Apache/Reload.pm (original)
+++ perl/Apache-Reload/trunk/lib/Apache/Reload.pm Thu May 10 00:15:24 2007
@@ -113,7 +113,7 @@
         }
     }
     
-    
+    my @changed;
     while (my($key, $file) = each %Apache::Reload::INCS) {
         local $^W;
         warn "Apache::Reload: Checking mtime of $key\n" if $DEBUG;
@@ -133,22 +133,27 @@
         unless (defined $Stat{$file}) {
             $Stat{$file} = $^T;
         }
-        
+		# remove the modules
         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;
     }
-    
+
+	# reload the modules
+	foreach my $key (@changed) {
+        warn("Reloading $key\n") if $DEBUG;
+        if (my $symref = $UndefFields{$key}) {
+            warn("undeffing fields\n") if $DEBUG;
+            no strict 'refs';
+            undef %{$symref};
+        }
+        require $key;
+        warn("Apache::Reload: process $$ reloading $key\n")
+            if $DEBUG;
+    }
+
     return 1;
 }