PM_WHICH(1p)
π PM_WHICH(1p) β the tea on finding installed modules π
okay bestie, listen. this is a page from the User Contributed Perl Documentation, and it's about a lil tool called pm_which. she's not complicated, she's just β¨helpfulβ¨, and by the end of this you're gonna be obsessed with her. no cap.
πΈ NAME πΈ
pm_which β find installed modules
β¨ SYNOPSIS β¨
pm_which [ options ] module(s)
Returns the path to the given module(s)
like literally that's it. you hand her modules, she hands you paths. queen behavior.
π OPTIONS π
-q,--quietβ just print paths, nothing else, no commentary, she's being mysterious π-p,--pathsβ just convert the module name into a relative path-a,--allβ print all the paths, not just the first one found-n,--namespaceβ print all modules in the given namespace-mβ only print module names, not paths-Vβ show module version-I libpathβ add a path to search (likeperl -I)-d,--dumpβ dump paths that would be searched (@INCby default)-h,--helpβ print this message-v,--versionβ print version information-β read modules from stdin, one per line
π DESCRIPTION π
this tool reports the locations of installed perl modules. that's the whole job, and she does it immaculately.
by default she lists the location of each specified module that would be loaded by require.
π¦ OPTION DETAILS π¦
quiet π€
under quiet mode, module names are suppressed and missing modules are not reported. so if you were emotionally attached to that "not found" text⦠sorry bestie, it's gone.
normal output:
$ pm_which Module::One Module::Two Missing::Module
Module::One - /path/to/Module/One.pm
Module::Two - /path/to/Module/Two.pm
Missing::Module - not found
under --quiet:
$ pm_which -q Module::One Module::Two Missing::Module
/path/to/Module/One.pm
/path/to/Module/Two.pm
see how the missing one justβ¦ vanishes? iconically unbothered. π
paths π£οΈ
in "paths" mode, each module is simply converted into a relative file path. this is possible even when the module is not installed β she's just doing math on the name, no filesystem required, it's giving genius fr fr.
$ pm_which -p Missing::Module
Missing/Module.pm
all π
when the "all" switch is specified, all installed modules will be reported, not just the first one. this is useful for determining when there is a module installed in multiple locations.
$ pm_which -a MyModule
/path/to/MyModule.pm
/home/me/perl/MyModule.pm
her range? unmatched. π
namespace π
arguments are taken as namespaces to search under. so you say one thing and she brings you the whole friend group.
$ pm_which -n MyModule
MyModule - /path/to/MyModule.pm
MyModule::Foo - /path/to/MyModule/Foo.pm
MyModule::Foo::Bar - /path/to/MyModule/Foo/Bar.pm
-m π«Ά
disables printing of module paths. this is only really useful in conjunction with --namespace.
$ pm_which -nm MyModule
MyModule
MyModule::Foo
MyModule::Foo::Bar
just names, no paths, minimal, clean, a little bit demure lowkey.
-V β
prints the version of each module, according to ExtUtils::MakeMaker.
$ pm_which -V MyModule
MyModule - /path/to/MyModule.pm [ 1.00 ]
$ pm_which -Vnm MyModule
MyModule [ 1.00 ]
MyModule::Foo [ 0.01 ]
MyModule::Foo::Bar [ undef ]
ok and notice [ undef ]? yeah. that module has no version and she is NOT going to pretend otherwise. honesty is the vibe. π
dump ποΈβ¨
dumps the paths that would be searched and exits. this is @INC modified by any -I switches.
$ pm_which --dump
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/vendor_perl/5.8.6
...
$ pm_which -I lib --dump -I blib/lib
lib
blib/lib
/usr/lib/perl5/site_perl/5.8.6
...
she peeks inside her own head and reads you the whole search list, then dips. main character exit. πͺ
version π
prints the version number of the script, plus the version and path of Module::Util that was loaded.
π EXIT CODES π
0β everything was OK1β initialisation failed (bad switches?)2β some modules were not installed
bestie if you're scripting around this, actually check these. exit code 2 is her gently telling you some of your modules simply do not exist. not a crash, just the truth. π«Ά
π SEE ALSO π
this utility comes with Module::Util. go say hi to her mom.
βοΈ AUTHOR βοΈ
Matt Lawrence <mattlaw@cpan.org>
one more thing ngl: this whole page is fromperl v5.36.0and it was dated2022-10-13β that's the source and the date, preserved forever like a little time capsule. π
and that's the page, bestie. go find your modules. slay. β¨π
π¦ where this page comes from
- ubuntu noble: libmodule-util-perl 1.09-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmodule-util-perl 1.09-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmodule-util-perl 1.09-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms