Stas Bekman wrote:
Philippe M. Chiasson wrote:
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.
Yes, I've noticed that issue as well and was thinking about a possible solution.
Right now, if you use Foo::Bar::Baz; modperl_perl_module_loaded('Foo') will return
true because the Foo:: stash has been created.
Yeah, that's another way to put it. It'd also be nice to have each of these cases tested :)
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.
Yes, that was the conclusion I reached as well. After seeing what Perl does,
looking at %INC seems to be the _only_ right way to test wether a module is
loaded or not.
+1
-- __________________________________________________________________ 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]
