gpt4 book ai didi

perl - 当我使用模块时如何找到 Perl 加载的文件?

转载 作者:行者123 更新时间:2023-12-03 06:17:11 24 4
gpt4 key购买 nike

在 Perl 中,当我这样做时 use <module name> <ver>; ,系统找到.pm @INC 中某处的库文件路径。

是否有可靠的方法来实际加载文件?

最佳答案

是的,%INC包含加载模块的完整路径。

示例:

$ perl -M'Data::Dump qw(pp)' -e 'pp(\%INC)'
{
"Data/Dump.pm" => "/usr/share/perl5/Data/Dump.pm",
"Exporter.pm" => "/usr/share/perl/5.10/Exporter.pm",
"List/Util.pm" => "/usr/lib/perl/5.10/List/Util.pm",
"Scalar/Util.pm" => "/usr/lib/perl/5.10/Scalar/Util.pm",
"XSLoader.pm" => "/usr/lib/perl/5.10/XSLoader.pm",
"overload.pm" => "/usr/share/perl/5.10/overload.pm",
"strict.pm" => "/usr/share/perl/5.10/strict.pm",
"vars.pm" => "/usr/share/perl/5.10/vars.pm",
"warnings.pm" => "/usr/share/perl/5.10/warnings.pm",
"warnings/register.pm" => "/usr/share/perl/5.10/warnings/register.pm",
}

关于perl - 当我使用模块时如何找到 Perl 加载的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/341484/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com