A
alexandre.melard
Hi there,
Promise, today, I will be very polite ;-)
I know I will surprise some of you by my question, but nevertheless I
have to ask...
I use a set of personal classes in a program which I locate using:
use lib "path/to/my/classes"
Everything is going well until I decide to share my program with other
people.
I decide to set up a configuration file in order to give the users a
chance to let the program find the necessary directories on their
systems (Linux gentoo for me).
I therefore put my main variables in a file "myconfig.rc" Then I load
the variables in my perl script using a loadConf sub.
The problem appear here! --> . <--
How is it possible to load the path/to/my/classes from a config file?
I tried to load my "config.rc" before loading the "use" statements, but
it is not working (Perl seems to load the "use" before anything else).
so it is not possible to do:
$pathToLib = undef;
unless( loadConf() ) { print "Error, vould not load conf" }
use lib "$pathToLib";
How could I do that?
Another big big question is: where can I store my config file on the
file system in order to be able to find it? I know I should put my
classes somewhere in the @INC or in my $ENV{PATH} but cannot figure out
where... I cannot put it in the home directory as the program is likely
to be used by different people with different home directory but the
conf need ot be the same for everybody.
I know you are very good to advise me on some reading, please let me
know were to dig and I will dig gldely
As usual, I greatly apreciate your help, believe it or not, I followed
perl course at uni and they **forgot** to let us know about all these
rather important things.
Alexandre.
Promise, today, I will be very polite ;-)
I know I will surprise some of you by my question, but nevertheless I
have to ask...
I use a set of personal classes in a program which I locate using:
use lib "path/to/my/classes"
Everything is going well until I decide to share my program with other
people.
I decide to set up a configuration file in order to give the users a
chance to let the program find the necessary directories on their
systems (Linux gentoo for me).
I therefore put my main variables in a file "myconfig.rc" Then I load
the variables in my perl script using a loadConf sub.
The problem appear here! --> . <--
How is it possible to load the path/to/my/classes from a config file?
I tried to load my "config.rc" before loading the "use" statements, but
it is not working (Perl seems to load the "use" before anything else).
so it is not possible to do:
$pathToLib = undef;
unless( loadConf() ) { print "Error, vould not load conf" }
use lib "$pathToLib";
How could I do that?
Another big big question is: where can I store my config file on the
file system in order to be able to find it? I know I should put my
classes somewhere in the @INC or in my $ENV{PATH} but cannot figure out
where... I cannot put it in the home directory as the program is likely
to be used by different people with different home directory but the
conf need ot be the same for everybody.
I know you are very good to advise me on some reading, please let me
know were to dig and I will dig gldely
As usual, I greatly apreciate your help, believe it or not, I followed
perl course at uni and they **forgot** to let us know about all these
rather important things.
Alexandre.