in reply to Modules sharing?

One slick way to handle that is by localizing STDERR. If $LOG is a reference to a file handle to log to,

use Module1 qw/$LOG/; use Module2; my $result = do { local *STDERR = $LOG; Module2::foo(42); };
That's obviously pretty awkward to use small scopes, but you can wrap larger ones - even the whole file - if you like.

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