Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find which file Perl loaded when I use a module?

Tags:

module

perl

in Perl, when I do use <module name> <ver>;, the system finds the .pm file for the library somewhere in the @INC path.

Is there a reliable way to which file was actually loaded?

like image 837
mmccoo Avatar asked Dec 04 '08 17:12

mmccoo


People also ask

How do you check if a module is installed perl?

Check installed perl modules via terminal Available commands are: l - List all installed modules m <module> - Select a module q - Quit the program cmd? Then type l to list all the installed modules, you can also use command m <module> to select the module and get its information. After finish, just type q to quit.


1 Answers

Yes, %INC contains the full path a module was loaded from.

Example:

$ 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", } 
like image 200
derobert Avatar answered Oct 03 '22 11:10

derobert