当我使用模块时,如何找到Perl加载哪个文件?

前端之家收集整理的这篇文章主要介绍了当我使用模块时,如何找到Perl加载哪个文件?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在Perl中,当我使用< module name> < ver&gt ;;,系统在@INC路径中的某处找到该库的.pm文件。 有没有一个可靠的方法到哪个文件实际加载?

解决方法

是, %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",}
原文链接:https://www.f2er.com/Perl/173437.html

猜你在找的Perl相关文章