无论如何,有没有告诉包启用了哪些功能?

Is there anyway to tell what features a package has enabled?

假设我想确保实现接口的人具有特定的实验性功能,

package Foo {
  use experimental "signatures";

}

有没有办法确定 Foo 启用了哪些功能,或者更具体地说是“实验性功能”?

否,因为 Foo 没有启用功能;功能与词法范围相关,而不是包。

该词法范围内的代码或从该词法范围调用的代码理论上可以使用来自 caller, but this value is essentially undocumented internals. Code from outside that scope would have to use something like PadWalker.

的 hinthash return 值测试启用的功能

如果您只想检查某些文件中是否存在特定功能,更好的方法是编写 perlcritic 规则。