This new patch addresses the issue Geoff pointed out. Deleting package Foo, shouldn't delete
package Foo::Bar.
It actually makes the patch a bit simpler, deleting all entries in the package's stash only
skipping the ones ending in '::'. Still works like a charm for me.
More Comments ?
+void modperl_clear_namespace(pTHX_ apr_pool_t *p, const char *package)
+{
+ /* delete $INC{'Some/Package.pm} */
+ modperl_delete_from_inc(aTHX_ p, package);
+
+ /* delete $Some::{'Package::'}; */
+ modperl_clear_stash(aTHX_ p, package);
+ + return;
}
Unrelated to the proposed patch, but the outcome may affect it a bit.
I see that we have a problem with modperl_perl_module_loaded, since it doesn't do what it suggests to do. If I say:
$Foo::bar = 1;
w/o loading Foo.pm. modperl_perl_module_loaded("Foo") will return true. And it's broken. I see that Perl modules use module_loaded to do the check, and think that the module was loaded when it might be not loaded at all.
Notice that PerlRequire/PerlModule *do not* check the stash's existence, precisely because some variables could get into the module's stash and it shouldn't prevent the module from loading.
I think this should be fixed to lookup in $INC, in which case the above code will need to be changed too.
Index: t/response/TestModules/reload.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestModules/reload.pm,v
retrieving revision 1.1
diff -u -I$Id -r1.1 reload.pm
--- t/response/TestModules/reload.pm 24 Aug 2004 17:36:56 -0000 1.1
+++ t/response/TestModules/reload.pm 24 Aug 2004 19:17:08 -0000
@@ -5,6 +5,8 @@
use Apache::Const -compile => qw(OK);
+use ModPerl::Util;
what is it for?
sub handler {
my $r = shift;
@@ -21,5 +23,4 @@
PerlModule Apache::Reload
PerlInitHandler Apache::TestHandler::same_interp_fixup Apache::Reload
PerlSetVar ReloadDebug On
-PerlSetVar ReloadConstantRedefineWarnings Off
PerlSetVar ReloadAll Off
Index: xs/ModPerl/Util/ModPerl__Util.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/ModPerl/Util/ModPerl__Util.h,v
retrieving revision 1.5
diff -u -I$Id -r1.5 ModPerl__Util.h
--- xs/ModPerl/Util/ModPerl__Util.h 4 Mar 2004 06:01:14 -0000 1.5
+++ xs/ModPerl/Util/ModPerl__Util.h 24 Aug 2004 19:17:08 -0000
@@ -28,5 +28,5 @@
#define mpxs_Apache_current_callback modperl_callback_current_callback_get
-
+#define mpxs_ModPerl__Util_clear_namespace(p, pkg) modperl_clear_namespace(aTHX_ p, pkg)
wrap long line?
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
