William McKee wrote:
On Thu, Feb 10, 2005 at 06:32:30PM -0500, Stas Bekman wrote:

That most likely means that someone redefines sub lib::import. Could be Time::Piece or something else used by that module. It's their fault, not A-T's one. You could easily verify that by adding something like:


I love hanging out with you guys; always something new to learn. Thanks
for the hints. Unfortunately the $SIG{__DIE__} trick didn't work.
Perhaps that's due to the fact that this bug lies within the UNIVERSAL
module. Basically, Time::Piece has the following line which is causing
the problems:

  use UNIVERSAL qw(isa);

From what I read about UNIVERSAL in its source, it causes the import
method to be redefined. I was able to create a script that reproduces
the error. The error happens under Linux as well. This begs the question
as to why A::T works without error on Linux but not on Windows.

Further testing has shown that order is important. If I place a 'use
lib' line *after* the use UNIVERSAL (or any other module which uses
UNIVERSAL), all is well. However, I still don't get the reason why these
tests would fail under Windows but work under Linux. There must be
something different about my Perl environment between the two.

Now, since we know that using the UNIVERSAL module is not uncommon,
should A::T take measures to defend against lib->import getting
redefined? Adding a 'use lib;' line just before the call to
lib->import($top_dir) works for me under WinXP and does not generate
redefine warnings.

Since it's not A-T's fault that someone has redefined the lib::import, I don't think it's for us to fix it. At least for now I believe it's the best that you apply the workaround in your code. i.e. after you load the module that redefines lib::import force the reload of lib.pm which should restore it back. alternatively you could remember the original sub and restore it w/o reloading lib.pm:


my $orig_sub = *lib::import{CODE};
require ModuleBreakinglibpm;
*lib::import = $orig_sub;

notice that it uses 'require' and not 'use'.

if later on we start getting more similar reports we will consider adding a workaround in A-T.

Sounds OK?

--
__________________________________________________________________
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

Reply via email to