|Problems? Is your data what you think it is?|
Passing a variable recursivelyby timtowtdi (Sexton)
|on Nov 04, 2012 at 20:49 UTC||Need Help??|
timtowtdi has asked for the
wisdom of the Perl Monks concerning the following question:
First, I know there has been written a lot about this issue, but I still have some issues with it. (Basically: I just don't understand :) )
I think I can explain my question the best with the factual example. What I want is setting a log-level in the main program, and let the printing be done by a module.
I've written my first Object-Oriented module, named: PrintToScreen.pm
And some perl-program to call that module and print, depending of course, on the log-level.setverbosity.pl
So far it works, but here's my issue:
I also use a module, named ConnectMySQL.pm, and I would like to pass the value of the log-level to that ConnectMySQL-module. That ConnectMySQL-module also contains 'use PrintToScreen'. So the log-level should be the same as the main program that's calling it.
Of course, the main idea behind al this that I can set the verbosity (/loglevel) while programming on 3, and when everything is finished, set it to 1, so it behaves normal. (including the used modules recursively)
I am afraid that my explanation stinks, but I still think you'll get my point.For example the ConnectMySQL.pm looks like this: (just imagine the mysql-connect-code)