Home > Archive > PERL Beginners > April 2004 > Set $Log::TraceMessages::On at module file level
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Set $Log::TraceMessages::On at module file level
|
|
| Claude 2004-04-25, 3:30 pm |
| I have the following problem:
The module variable "$Log::TraceMessages::On" tells all calls to
"trace()" to print an argument (1) or not to (0).
Now, I'd like to split my program between my own module and my own
file using it. I'd like as well to use "trace()" for different
purposes during the execution of my program: for example, from command
line, setting trace 'on' only in the scope of my component or in the
scope of other files or not setting it at all. Some kind of tracing
level implementation.
The Log::TraceMessages module pod says that making the variable
"local" would do it. Unfortunately, I failed to see how I can set the
local scope to a _whole_ _file_ instead of a block like the doc says:
{ # ok but not file _scope_
local $Log::TraceMessages::On = 0;
t 'this message will not be printed';
}
# this is what I'd like, but fail to do that in my module file
local $Log::TraceMessages::On = $trace;
Any idea how to do tha?
--
Claude
| |
| Claude 2004-04-27, 12:23 am |
| I'll try to re-phrase my question, as I didn't get any answer:
How can I set to "local" a globally defined variable, in order to get
file scope in a module file?
--
Claude
|
|
|
|
|