Closed kentfredric closed 9 years ago
I wonder if we should just take this Log::Contextual bit out. It seems to have been there since before the module was split off from Module::Build, and doesn't really make sense in a core module. e.g. none of the other core modules have special treatment for LC loggers.
@shadowcat-mst can you provide some history?
I see nothing wrong with the patch though, so let's merge it :)
If by chance Module::Metadata happened to be loaded in a system where Log::Contextual was loaded, but not configured, Module::Metadata calling the relevant logging methods caused a fatal exception.
This change permits Module::Metadata to construct its own logger if it plans on using Log::Contexual, such that if one is not configured, the default will still work.
Additionally, the default logger can be adjusted in the user ENV by tweaking MODULEMETADATA<> fields when Log::Contexual is loaded.
Its unlikely a user will stumble into this edge case, as it only happens in error conditions, and then, only in a rarely used codepath in Module::Metadata.
Namely:
Of these methods, only package_versions_from_directory has a single test, and that single test doesn't trip the error conditions.