PM_WHICH(1)
π PM_WHICH π
okay so bestie, listen β pm_which is literally the tool that finds your installed modules for you. no cap, it's giving "where did I put my keys" but for Perl. you're gonna love her.
β¨ SYNOPSIS β¨
pm_which [ options ] module(s)
Returns the path to the given module(s) β like a little treasure map but for .pm files πΊοΈπ
π OPTIONS π
-q,--quietβ Just print paths. no small talk, no extra vibes.-p,--pathsβ Just convert the module name into a relative path.-a,--allβ Print all paths, not just the first one found. when you need receipts π-n,--namespaceβ Print all modules in the given namespace.-mβ Only print module names, not paths. literally just the names, bestie.-Vβ Show module version. because sometimes you gotta know.-Ilibpath β Add a path to search (likeperl -I). your custom stash π-d,--dumpβ Dump paths that would be searched (@INCby default).-h,--helpβ Print this message. we love a helpful icon.-v,--versionβ Print version information.-β Read modules from stdin, one per line. feed her lines like a queen π
πΈ DESCRIPTION πΈ
okay so this tool reports the locations of installed perl modules. that's it. that's the vibe.
by default it lists the location of each specified module that would be loaded by require. simple. elegant. iconic.
π¦ OPTION DETAILS π¦
π quiet
under quiet mode, module names are suppressed and missing modules are not reported. it's giving "no small talk hours."
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... doesn't show up? she's not gonna embarrass herself by reporting a ghost. π
π paths
in "paths" mode, each module is simply converted into a relative file path. this is possible even when the module is not installed. so you can manifest it into existence, kinda? β¨
$ 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. like when you have the same hoodie in three colors β except it's .pm files and slightly less cute π«Ά
$ pm_which -a MyModule
/path/to/MyModule.pm
/home/me/perl/MyModule.pm
π§ namespace
arguments are taken as namespaces to search under. it's giving "show me the whole family tree" π³
$ 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. like, it's not the main character on its own, but paired with -n? lowkey iconic.
$ pm_which -nm MyModule
MyModule
MyModule::Foo
MyModule::Foo::Bar
π₯ -V
prints the version of each module, according to ExtUtils::MakeMaker. because sometimes you need to know exactly what version you're dealing with. it's giving "check the tag before you commit" π·οΈ
$ 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 ]
not the [ undef ] for the last one π she tried her best.
β dump
dumps the paths that would be searched and exits. this is @INC modified by any -I switches. think of it as "what's in the search bag before we go looking" π
$ 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
...
π version
prints the version number of the script, plus the version and path of Module::Util that was loaded. the whole "about me" page but for a script π
π EXIT CODES π
0β Everything was OK. slay.1β Initialisation failed (bad switches?). it happens to the best of us π2β Some modules were not installed. they ghosted you, fr.
π SEE ALSO π
this utility comes with Module::Util. so like, they're besties. they come together. dynamic duo energy π«Ά
π AUTHOR π
Matt Lawrence <mattlaw@cpan.org>
that's the whole thing, bestie! go forth and find those modules. you got this π β¨
this slay of a script was last updated on 2023-01-20 and runs on perl v5.32.1. iconic behavior all around π
π¦ where this page comes from
- epel 9: perl-Module-Util 1.09-31.el9 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms