Perl-Toolchain-Gang/Module-Build — comment on commit 886abd6b50511cc3183162817cae0fdfa18f060f
File:  line 0
By dagolden:

>> Also, PERL_MB_OPT has exactly the same issue (it always overrides the
>> Build.PL arguments), and no way out.
>>
>>
> Did I do that? That seems bad. Command-line args should have highest
> precedence, followed by Build.PL args, followed by the environment
> variable. What's the current state of this?

PERL_MB_OPT was added to parallel PERL_MM_OPT, which is essential for
local::lib to do its magic effectively.

The precedence of options is always a bit hairy because of the way
that Build.PL caches arguments and applies them later, yet allows
subsequent actions to override them.

PERL_MB_OPT is split like shell and prepended to all command line
arguments -- thus they apply to *all* actions (Build.PL/Build
whatever), but with lower precedence than actual arguments given on
the command line. It *is* documented that way.

So, I think the current precedence is: command line arguments,
PERL_MB_OPT arguments, modulebuildrc arguments (for a given action),
then cached Build.PL settings. (But it's been a while since I
reviewed the hash merging code.)