>>
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;