One slick way to handle that is by localizing STDERR. If $LOG is a reference to a file handle to log to,
That's obviously pretty awkward to use small scopes, but you can wrap larger ones - even the whole file - if you like.use Module1 qw/$LOG/; use Module2; my $result = do { local *STDERR = $LOG; Module2::foo(42); };
With that, Module2 doesn't have to anticipate anything about logging. It only needs to make its complaints to STDERR and it is up to the user to redirect to the log handle.
After Compline,
Zaxo
In reply to Re: Modules sharing?
by Zaxo
in thread Modules sharing?
by eff_i_g
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |