note
Aristotle
No, that won't work. The [perlfunc:use|use] inside the [perlfunc:eval|eval BLOCK] is compiled at compile time, but the string in [perlfunc:eval|eval EXPR] is not. <tt>eval "use Foo";</tt> is nothing but an obfuscated way to say <tt>require Foo; Foo->import;</tt></p>
<p>Neither case is a job for [perlfunc:eval|eval] here. If you want variable paths at compile time, you do the following:</p>
<code>my $libpath;
BEGIN { $libpath = "/foo/bar"; }
use lib $libpath;
</code>
If you want to load modules with dynamic <tt>@INC</tt> at runtime, you make use of the aforemention construct:
<code>{
local @INC = ("/foo/bar", @INC);
require Foo;
Foo->import;
}
</code>
[perlfunc:eval|eval] will not help. And <tt>$a</tt> is a really awful name for a variable (plus <tt>$a</tt> and <tt>$b</tt> are reserved for [perlfunc:sort|sort]). <tt>:)</tt>
<p align="right"><em>Makeshifts last the longest.</em></p>
217438
227561