Maybe declare our $logLine; in your main perl script (index.mojo) and then access the variable in each of the files you require with its fully qualified name which will be $main::logLine ?
However, if it was me, I would create a logging class and instantiate a global log object. Which will have api like log("hello") and toString() and toHTML(). In this way I expand my logging capabilities as much as I like with just one single global variable (the log object). And when I feel like, I modify all my subs to take just one additional parameter which will be the log object. No matter how I modify the log object in the future, I will not need a second global variable and I will not need to modify my subs for a second time...
bw, bliako
In reply to Re: Logging to web page with Mojolicious and strict
by bliako
in thread Logging to web page with Mojolicious and strict
by TieUpYourCamel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |