| Paul Lalli 2006-01-10, 4:02 am |
| Wayne Happ wrote:
> I have a question about finding a module at rutime.
>
> Here's what I would like to do.
>
> push(@INC, @notknowntillrunning);
>
> use lib 'notknowntill running';
You need to make up your mind. 'use lib' effectively does a 'push
@INC', but does it at compile time. You said you wanted to do this at
runtime, so use the 'push @INC' variant.
> use foo;
'use' does two things, and does them both at compile time. If you want
what use does to happen at run time, simply call those two things
explicitly:
require foo;
foo->import;
> My problem is I do not know the where the Module will be till the script
> runs. Perl won't compile the script because at time of compilation the
> enviroment is not known.
"won't compile" is not especially helpful without knowing what the
compilation error is. Why did you choose not to share that information
with us?
For more information:
perldoc -f use
perldoc lib
perldoc perlvar (search for @INC)
Paul Lalli
|