EXTUTILS::INSTALLED(3perl)
π NAME π
ExtUtils::Installed β inventory management of installed modules, bestie. like literally a whole little accountant for everything you've installed π§Ύβ¨
πΈ SYNOPSIS πΈ
use ExtUtils::Installed;
my ($inst) = ExtUtils::Installed->new( skip_cwd => 1 );
my (@modules) = $inst->modules();
my (@missing) = $inst->validate("DBI");
my $all_files = $inst->files("DBI");
my $files_below_usr_local = $inst->files("DBI", "all", "/usr/local");
my $all_dirs = $inst->directories("DBI");
my $dirs_below_usr_local = $inst->directory_tree("DBI", "prog");
my $packlist = $inst->packlist("DBI");
π¦ DESCRIPTION π¦
okay so, ExtUtils::Installed gives you a standard way to figure out what core files and module files have actually been installed on your system. no guessing, no vibes-based archaeology π
it works by reading all the info stashed inside .packlist files β those little receipts that get created during installation. π¦
and that's not all, babes β it also gives you the tools to classify the installed files and to extract directory information out of those same .packlist files. it's giving librarian energy fr fr π
β¨ USAGE β¨
the new() function goes out and searches for all the installed .packlists on the system, and then stores their contents. after that you can query those .packlists with all the functions described down below. π΅οΈβοΈ
where does it search by default, you ask? that's decided by the settings it finds in %Config::Config, plus whatever value the PERL5LIB environment variable happens to be holding. that's the whole vibe check right there π
π METHODS π
unless it says otherwise, every single method can be called either as a class method or as an object method. if you call them as class methods, then the "default" object gets used β and if it doesn't exist yet, it'll be created using the current process's %Config and @INC. see the 'default' option to new() for the details, iykyk π
π§ new()
this takes optional named parameters. without any parameters, it searches for all the installed .packlists on the system, using info from %Config::Config and the default module search paths in @INC. the packlists get read using the ExtUtils::Packlist module. π
if the named parameter "skip_cwd" is true, then the current directory "." gets stripped from @INC before it goes searching for .packlists. this keeps ExtUtils::Installed from finding modules that were installed in other perls which just so happen to be located below the current directory. sneaky little gremlins, we see you π
if the named parameter "config_override" is specified, it should be a reference to a hash containing all the information usually found in %Config::Config. for example, you can grab the configuration information from a separate perl installation and pass that baby right in. π«Ά
my $yoda_cfg = get_fake_config('yoda');
my $yoda_inst =
ExtUtils::Installed->new(config_override=>$yoda_cfg);
similarly, the parameter "inc_override" may be a reference to an array, which gets used in place of the default module search paths from @INC. π¦
use Config;
my @dirs = split(/\Q$Config{path_sep}\E/, $ENV{PERL5LIB});
my $p5libs = ExtUtils::Installed->new(inc_override=>\@dirs);
Note: you probably do not want to use these options on their own. like, almost always you're gonna want to set both of them together. noted π
the parameter "extra_libs" can be used to specify additional paths to search for installed modules. for instance:
my $installed =
ExtUtils::Installed->new(extra_libs=>["/my/lib/path"]);
this should only be necessary if /my/lib/path is not in PERL5LIB. okurrr π
finally, there's the 'default' option, plus the related 'default_get' and 'default_set' options. these control the "default" object that the class interface to the methods hands out. setting "default_get" to true tells the constructor to return the default object if it's defined. setting "default_set" to true tells the constructor to make the default object be the constructed object. setting the "default" option is basically like setting both of them to true at once. π
this is used primarily internally, and it probably isn't interesting to any real user. not me exposing the internals like that π lowkey move along bestie
π modules()
this returns a list of the names of all the installed modules. and the perl 'core' gets the special name 'Perl' β yes, capital P, she's famous π
π files()
this takes one mandatory parameter: the name of a module. it returns a list of all the filenames from the package. π
want the list of core perl files? just use the module name 'Perl'. easy.
additional parameters are allowed too:
- the first extra one β one of the strings
"prog","doc"or"all", to select either just program files, just manual files, or all the files. pick your fighter β¨ - the remaining ones β a list of directories. the filenames you get back will be restricted to those under the specified directories. π
π§ directories()
this takes one mandatory parameter: the name of a module. it returns a list of all the directories from the package. π
additional parameters are allowed, same deal as before:
- the first extra one β one of the strings
"prog","doc"or"all", to select either just program directories, just manual directories, or all directories. - the remaining ones β a list of directories. the directories returned will be restricted to those under the specified directories.
and one thing to know: this method returns only the leaf directories that contain files from the specified module. just the tips of the branches, not the whole tree π³βοΈ
πΈ directory_tree()
this is identical in operation to directories() β except that it also includes all the intermediate directories back up to the specified directories. now you get the whole family tree, ancestors included π
π validate()
this takes one mandatory parameter: the name of a module. it checks that all the files listed in the module's .packlist actually exist, and it returns a list of any missing files. π¨
if you give it an optional second argument that evaluates to true, then any missing files will get removed from the .packlist. so, like, say bye to them ππ«Ά
π packlist()
this returns the ExtUtils::Packlist object for the specified module. one tidy little object, served fresh β¨
β version()
this returns the version number for the specified module. iconic number reveal moment π
π EXAMPLE π
go look at the example over in ExtUtils::Packlist. it's right there bestie, i'm not retyping it π§
π«Ά AUTHOR π«Ά
Alan Burlison <Alan.Burlison@uk.sun.com> β periodt. absolute legend behavior π
and that's the whole page, babes! this was perl v5.44.0, dated 2026-10-17, living in the Perl Programmers Reference Guide. mwah, go forth and inventory your modules responsibly ππΈβ¨ππ¦
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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