Subject: | Load msg_merge dependencies dynamically |
If the user has just *installed* the Dist::Zilla::App::Command::msg_merge, all his dzil build will get a performance hit (even projects not using Dist::Zilla::Locale::TextDomain) because all DZ::App::Command plugins are loaded and msg_merge loads many other modules. This is a waste of resources when the 'msg_merge' command is not executed.
(of course this is a major flaw in App::Cmd, but I've not found an easy solution to this)
You can check the issue with this command (using Devel::TraceUse) in an empty directory:
perl -d:TraceUse -S dzil nop
To fix this, dependencies in Dist::Zilla::App::Command::msg_merge should be loaded dynamically (using 'require') in the 'execute' method.
See for example this patch applied to another Dist::Zilla::App::Command:
https://github.com/dolmen/p5-Dist-Zilla-App-Command-kwalitee/commit/c8cb663ee23949e83f0d0bcc663fd2adc130c439
--
Olivier Mengué - http://perlresume.org/DOLMEN