B
Bernd Schneider
Hello!
I am developing a small web-based application (customer-frontend).
It used to be quite small so that I keeped everything in one file
(index.pl). In the head I defined all the variables etc. and that was it.
But now the application is getting a bit more complex with some scripts
being only run from the command line and having nothing to do with the
web-interface yet still sharing some common library.
So I decided to put some stuff into modules.
The problem that I now come up with is:
Where do I put the variables?
Before I just declared them as:
my $mysql_host = 'localhost';
[...]
Now I have several packages and they in turn use these variables as well.
I now use a self-written script which reads the variables from a
textfile. And I put all this into a Module called Settings.pm.
So my call to a setting would be:
$Settings::value{'key'}
e.g.
$Settings::value{'mysql_host'}
But I am not too sure if this is the right way.
Do you have any hints to to deal with these settings properly?
Thanks in advance!
I am developing a small web-based application (customer-frontend).
It used to be quite small so that I keeped everything in one file
(index.pl). In the head I defined all the variables etc. and that was it.
But now the application is getting a bit more complex with some scripts
being only run from the command line and having nothing to do with the
web-interface yet still sharing some common library.
So I decided to put some stuff into modules.
The problem that I now come up with is:
Where do I put the variables?
Before I just declared them as:
my $mysql_host = 'localhost';
[...]
Now I have several packages and they in turn use these variables as well.
I now use a self-written script which reads the variables from a
textfile. And I put all this into a Module called Settings.pm.
So my call to a setting would be:
$Settings::value{'key'}
e.g.
$Settings::value{'mysql_host'}
But I am not too sure if this is the right way.
Do you have any hints to to deal with these settings properly?
Thanks in advance!