Problem accessing fully qualified global var from another package

I've got a script with several modules, including one that reads in data
from a configuration file. The module then stores the retrieved data in
global variables, e.g. one that is declared with 'our $dataDirectory'.
My log module needs to retrieve a path where to store its log file in,
which is also retrieved by the Config.pm module. Here is the code:

I monitor $Logalizer::Config::logDirectory with carp()s and I get the correct path, let's say '/path/to/logfile'. I also monitor $logName, what I get, however, is '/logalizer.log', i.e. $Logalizer::Config::logDirectory doesn't seem to be interpolated in the above assignment. What's even more amazing is that the very same kind of assignment works in all the other modules. It's probably something obvious but I'm really at a loss here. Does anybody know what's going wrong and what I can do about it?

Where? I don't see any carp()s in the above code. At what point in
the code are you confirming that this variable has the value you expect
it to? That is a necessary piece of information.
> I also monitor $logName, what I get, however, is '/logalizer.log', i.e.
> $Logalizer::Config::logDirectory doesn't seem to be interpolated in the above
> assignment.

Again, where?
> Does anybody know what's going wrong and what I can do about it?

We can't answer that with any certainty with the information provided.
My *guess* is that you are confirming the correctness of the variable
at some point in the code that is executed after the $logName
assignment is made.

Please post a short, but *complete*, program, that we can run by copy
and pasting, which demonstrates your error.

Advertisements

> We can't answer that with any certainty with the information provided.
> My *guess* is that you are confirming the correctness of the variable
> at some point in the code that is executed after the $logName
> assignment is made.
>
> Please post a short, but *complete*, program, that we can run by copy
> and pasting, which demonstrates your error.
>
> Paul Lalli

I fear posting an executable version of the script would contain several hundred lines of code, so that probably is out of the question. I can, however, try to provide you with as much information as possible.
The modules that are interesting for the problem are

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!