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 go...@apache.org on 2006/01/18 03:02:30 UTC
svn commit: r370007 - in /perl/modperl/trunk: Changes lib/Apache2/Reload.pm
Author: gozer
Date: Tue Jan 17 18:02:28 2006
New Revision: 370007
URL: http://svn.apache.org/viewcvs?rev=370007&view=rev
Log:
When multiple modules need to be reloaded, trying to
unload/reload them one at a time was wrong. It's much
safer to first unload them all, then attempt to reload
them. This way, if multiple modified modules have inter-
dependencies, they will satisfy themselves.
Reported-By: Javier Uruen Val <ju...@warp.es>
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/lib/Apache2/Reload.pm
Modified: perl/modperl/trunk/Changes
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=370007&r1=370006&r2=370007&view=diff
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Tue Jan 17 18:02:28 2006
@@ -12,6 +12,11 @@
=item 2.0.3-dev
+Apache2::Reload now first unloads all modified modules before
+trying to reload them. This way, inter-module dependencies
+are more likely to be correctly satisfied when reloaded
+[Javier Uruen Val <ju...@warp.es>, Gozer]
+
$r->add_config() can now take an optionnal 3rd argument that
specifies what pseudo <Location $path> the configuration is
evaluated into [Torsten Foertsch <to...@gmx.net>]
Modified: perl/modperl/trunk/lib/Apache2/Reload.pm
URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Reload.pm?rev=370007&r1=370006&r2=370007&view=diff
==============================================================================
--- perl/modperl/trunk/lib/Apache2/Reload.pm (original)
+++ perl/modperl/trunk/lib/Apache2/Reload.pm Tue Jan 17 18:02:28 2006
@@ -131,6 +131,8 @@
my $ReloadDirs = ref($o) && $o->dir_config("ReloadDirectories");
my @watch_dirs = split(/\s+/, $ReloadDirs||'');
+
+ my @changed;
foreach my $key (sort { $a cmp $b } keys %Apache2::Reload::INCS) {
my $file = $Apache2::Reload::INCS{$key};
@@ -155,13 +157,24 @@
}
if ($mtime > $Stat{$file}) {
- my $package = module_to_package($key);
- ModPerl::Util::unload_package($package);
- require $key;
- warn("Apache2::Reload: process $$ reloading $package from $key\n")
- if $DEBUG;
+ push @changed, $key;
}
$Stat{$file} = $mtime;
+ }
+
+ #First, let's unload all changed modules
+ foreach my $module (@changed) {
+ my $package = module_to_package($module);
+ ModPerl::Util::unload_package($package);
+ }
+
+ #Then, let's reload them all, so that module dependencies can satisfy
+ #themselves in the correct order.
+ foreach my $module (@changed) {
+ my $package = module_to_package($module);
+ require $module;
+ warn("Apache2::Reload: process $$ reloading $package from $module\n")
+ if $DEBUG;
}
return Apache2::Const::OK;