in reply to Re^4: use lib and use autouse 'module'
in thread use lib and use autouse 'module'

would the use lib $g_moduleDir;give a runtime error?

Didn't yesterday when I posted that, and didn't right now. This is what I tried:

use lib '/home/hue/nonexistent'; use autouse 'FOO' => qw/foo/; sleep 10; foo;

Then, in another console, did a mkdir nonexistent; mv FOO.pm nonexistent. No warnings or errors from the program, it just run seamlessly.

Empty compile time value given to use lib

It seems you passed an empty variable to lib. Check it.

--
David Serrano

Replies are listed 'Best First'.
Re^6: use lib and use autouse 'module'
by sshivell (Initiate) on Aug 22, 2006 at 17:51 UTC
    >> would the use lib $g_moduleDir;give a runtime error?

    Yes. use lib $g_moduleDir would need to be processed at RUNTIME after the $g_moduleDir variable has been set. Unfortunately "use" is processed at compile time and as such $g_moduleDir has not been set which will always create the empty string error that you have seen. You can hard code the path and it will work  use lib 'path/to/my/personal/lib/dir'

    *Update:

    Amusingly enough you can do something like this
    #!/usr/bin/perl BEGIN{ use Config::YAML; our $c= Config::YAML->new("/pathtoconfigfile"); our $inc_path = $c->get_includePath; } use lib $inc_path;