From: "Amit Saxena" <[EMAIL PROTECTED]>
> I still doubt whether
>
> * unshift (@INC,$librarydir);*
>
> works or not.
>
> To the best I have read the articles and tutorials, @INC can't be updated in
> this way.
Then you've read them wrong. Of course you can use unshift() on @INC,
you just have to make sure it happens soon enough. Which means it
either has to be within a module either in import() or outside any
subroutines or in a BEGIN{} block.
You simply have to make sure the statement RUNS before the use
statement that depends on that directory COMPILES. Which is quite
possible in Perl.
Eg.
#!perl
BEGIN {
do some computation regarding $librarydir
unshift (@INC,$librarydir);
}
use My::Own::Library;
...
__END_
or
#!perl
use SetUpLibraryDir;
# this module must be in the default @INC directories
use My::Own::Library;
...
__END_
where in SetUpLibraryDir.pm you might have just
do some computation regarding $librarydir
unshift (@INC,$librarydir);
1;
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/