I would like to translate a Perl package name to the full path of the file.
say package_name_to_path('Foo::Bar::Baz'); /tmp/Foo/Bar/Baz.pm
I know there is a CPAN module to do this? I just can’t find it again?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’ve loaded the module, just look in %INC but you have to do it by filename.
If you haven’t, you can use Module::Util or the module_info program which comes with Module::Info.
Or you can go through @INC manually.
(A fully cross platform solution would use File::Spec instead of joining with slashes.)
If you just need to find a module quick,
perldoc -lworks well as Fayland mentioned, but it will fail to find a module that has no POD.