Why does Perl compile diagnostics.pm if I have no diagnostics in my code?

南笙酒味 提交于 2019-12-03 22:13:37

Am I correct in assuming that if I call no diagnostics, it is actually loaded before it is unimported?

Yes. Its indeed full equivalent to

BEGIN {
  require diagnostics;
  diagnostics->unimport;
}

So no module command actually loads and compiles the module; including executing the code which is not in any sub, in BEGIN block etc; same for all dependencies of given module(for every use/ require inside).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!