William McKee wrote:
Stas,

I ran some tests before making this request to p5p. In doing so, it
turns out the cure is not much better than the bug; it really just
side skirts the problem by doing an empty return (see the import method
that's been added to UNIVERSAL.pm in bleadperl).

We still are faced with the problem that importing UNIVERSAL is
overwriting/overloading the import subroutine in lib (and apparently all other
loaded modules). Furthermore, from the notes in UNIVERSAL, this behavior
can't be fixed. This leads me to want to avoid use UNIVERSAL in any of
my code but I can't fix all the released modules.

Given that A::T is calling the undocumented method lib->import directly,

why undocumented?

use lib LIST;

is the same as:

BEGIN {
  require lib;
  lib->import(LIST);
}

the only difference is that we don't have the BEGIN block. So it happens at run time and not compile time.

it seems it should work around this problem if tests import UNIVERSAL.
Could line 223 in A::TestConfig be changed to the following:

unshift(@INC, $topdir);

It's not the same because lib::import does more than that (removing dups, inserting arch-specific dirs, etc.). Though in this particular case one could argue that your solution above is almost an equivalent.


I'd still suggest to first write a simple standalone case that demonstrates the problem and see if p5p has anything insightful to say about it. We can work out the test case here.

For example this:

  perl -wle 'use lib "/tmp"; use UNIVERSAL qw(isa); \
       lib->import("/tmp/foo"); print join "\n", @INC'

seems to work just fine. Can you break it?

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