Subject: | Compilation times are incorrect and probably impossible to compute |
Once the required module has been found, trace_use tries to load
it using the following line:
eval "package $package; require '$mod_name';";
This usually fails silently (to verify that most of those eval lines
fail, just add a print $@ if $@ line after it), but since the hook ends
with a bare return, Perl picks up the requested module, and continues
processing @INC.
So the compilation time shown is actually the time it took to NOT find
and compile the requested module.
require fails with $mod_name, because require expects a bareword for
module names, which it will translate to the ::-notation. If given a
string, it is assumed to be a filename.
It is possible to make that eval "require" work, and get a proper
compilation time, by using $module (the parameter received by the hook)
as the string passed to require.
However, since @INC has been modified a few lines above to explicitely
exclude the hook (to avoid infinite loops), we lose the ability to
inspect modules that are loaded from deeper.
Therefore, I think it is not possible to obtain a compilation time
for all the modules loaded.