On 26/12/08 20:39, David Ihnen wrote:
1. Problem Description:
While developing with CGI::Application and utilizing Apache::Reload, we
encountered an issue where our modules were not being succesfully
reinitialized on reload. It was traced down to @ISA not containing the
proper values after a 'use base' directive, but only on automatic
reload, and freshly on perl 5.10, not our previous version of perl 5.8.8!
I determined that when ModPerl::Util::unload_package is used to unload a
package, when it is then re-required in perl 5.10, 'use base' directives
don't function as expected.
I recreated the problem with this simple use case. It happens when a
sub-module (required by something else) is unloaded then re-required. I
included the workaround using the push @ISA method to contrast working
with not working.
This is the output when the program below is run.
$ perl t.pl
X
X
V
Not a CODE reference at t.pl line 14.
Where did the inheritance go after the require of v? Is this a bug in
the do-file functionality utilized by require? Did
ModPerl::Util::unload_package not do something it was supposed to? Is
there a subtle interaction between 5.10 and ModPerl::Util?
I was initially going to submit this to the perl bug database, but
realized that the unload_package function was a ModPerl functionality,
so this is my first place to go. Five files to test with itemized
below. As you can see, I can recreate it without utilizing the mod_perl
environment specifically.
--- begin t.pl ---
#!/usr/bin/perl
use ModPerl::Util;
# Using push @ISA
require w;
w->x();
ModPerl::Util::unload_package('w');
require w;
w->x();
# Using use base
require u;
u->v();
ModPerl::Util::unload_package('v');
require u;
This is strange, as you are unloading 'v' and reloading 'u', probably not
what was intended.
--
Philippe M. Chiasson GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/ m/gozer\@(apache|cpan|ectoplasm)\.org/