Use do rather than require to load a mojo application to fix compatibility with new module_true core feature.
Motivation
The return value of require is usually not a reasonable thing to rely on, aside from it being true. The first time requiring a file, it will return the value of the last statement in the file. The second time requiring a file, it will return a simple true value.
Mojo was bypassing this problem by deleting the %INC entry for the file, forcing it to always be loaded again. But the new module_true core feature will cause require to always return a simple true value rather than the last statement in the file. This does not apply to do though.
Summary
Use
do
rather thanrequire
to load a mojo application to fix compatibility with newmodule_true
core feature.Motivation
The return value of
require
is usually not a reasonable thing to rely on, aside from it being true. The first time requiring a file, it will return the value of the last statement in the file. The second time requiring a file, it will return a simple true value.Mojo was bypassing this problem by deleting the
%INC
entry for the file, forcing it to always be loaded again. But the newmodule_true
core feature will causerequire
to always return a simple true value rather than the last statement in the file. This does not apply todo
though.References
2094