On Friday, February 7, 2003, at 01:48 PM, Mark Alldritt wrote:
I don't think you should have any path issues with require(), as use() just calls require() at compile time. Are you chdir()-ing inside the script?Thank you to all who replied to my query.For the archive record, that won't work, because 'use' is done atQuite right - my bad. Also, as Dan pointed out, there's more to it than
compile-time (here, the compile-time of the BEGIN block, which is
Compile Man's compile-time), before the if() statement has a chance to
work.
simply checking for the appropriate version - multiplicity, threading,
and 64-bit support are all compile-time options that affect binary
compatibility.
I assume that I can replace use with require to get around the compile-time
issue. However, when I do this, I run into lots of path issues since the XS
module needs to access the blib/lib and blib/arch directors as well.
The following should work to load module Foo::Bar at runtime:
require Foo::Bar; # must be a literal bareword module name
eval "use Foo::Bar";
require "Foo/Bar.pm";
-Ken