Folks,

I've run into a couple of issues with use and was hoping someone could
help me come up with a solution.

First, I use a specific module in a work environment to set some global
variables. I want to re-use my code in another environment which doesn't
have the specific configuration module. I don't want to have to keep two
separate copies of the code. What I currently use in the work
environment is of the format:

use lib '/path/to/work/modules';
use Prefs;

my $config = Prefs->new();
my $param1 = $config->get("PARAM1");

I'd like to something of the format:

my $param1;
if (-f '/path/to/work/modules/Prefs.pm') {
        use lib '/path/to/work/modules';
        use Prefs;

        my $config = Prefs->new();
        $param1 = $config->get("PARAM1");
}
else {
        $param1 = "default value here";
}

Is something like this possible?

Also, some of the config-style modules I use store their configuration
values with the module itself. Using the above example Prefs.pm, the
function $config->get("PARAM1") might look like: 

my $self = shift;
my $val = shift;
return $self->{DATA}{$val};

I have code which runs daemonized (using Proc::Daemon) that begins by
using the Prefs config module. It's quite possible that the parameters
in the Prefs config module get modified. I may need my daemonized code
to "refresh" its copy of the Prefs config module to pull in the new
parameters. Can this be done, or do I have to stop the daemon and
restart it?

Thanks all!
- Ed

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to