1ExtUtils::Installed(3pm)Perl Programmers Reference GuideExtUtils::Installed(3pm)
2
3
4
6 ExtUtils::Installed - Inventory management of installed modules
7
9 use ExtUtils::Installed;
10 my ($inst) = ExtUtils::Installed->new();
11 my (@modules) = $inst->modules();
12 my (@missing) = $inst->validate("DBI");
13 my $all_files = $inst->files("DBI");
14 my $files_below_usr_local = $inst->files("DBI", "all", "/usr/local");
15 my $all_dirs = $inst->directories("DBI");
16 my $dirs_below_usr_local = $inst->directory_tree("DBI", "prog");
17 my $packlist = $inst->packlist("DBI");
18
20 ExtUtils::Installed provides a standard way to find out what core and
21 module files have been installed. It uses the information stored in
22 .packlist files created during installation to provide this
23 information. In addition it provides facilities to classify the
24 installed files and to extract directory information from the .packlist
25 files.
26
28 The new() function searches for all the installed .packlists on the
29 system, and stores their contents. The .packlists can be queried with
30 the functions described below. Where it searches by default is
31 determined by the settings found in %Config::Config, and what the value
32 is of the PERL5LIB environment variable.
33
35 Unless specified otherwise all method can be called as class methods,
36 or as object methods. If called as class methods then the "default"
37 object will be used, and if necessary created using the current
38 processes %Config and @INC. See the 'default' option to new() for
39 details.
40
41 new()
42 This takes optional named parameters. Without parameters, this
43 searches for all the installed .packlists on the system using
44 information from %Config::Config and the default module search
45 paths @INC. The packlists are read using the ExtUtils::Packlist
46 module.
47
48 If the named parameter "config_override" is specified, it should be
49 a reference to a hash which contains all information usually found
50 in %Config::Config. For example, you can obtain the configuration
51 information for a separate perl installation and pass that in.
52
53 my $yoda_cfg = get_fake_config('yoda');
54 my $yoda_inst = ExtUtils::Installed->new(config_override=>$yoda_cfg);
55
56 Similarly, the parameter "inc_override" may be a reference to an
57 array which is used in place of the default module search paths
58 from @INC.
59
60 use Config;
61 my @dirs = split(/\Q$Config{path_sep}\E/, $ENV{PERL5LIB});
62 my $p5libs = ExtUtils::Installed->new(inc_override=>\@dirs);
63
64 Note: You probably do not want to use these options alone, almost
65 always you will want to set both together.
66
67 The parameter c<extra_libs> can be used to specify additional paths
68 to search for installed modules. For instance
69
70 my $installed = ExtUtils::Installed->new(extra_libs=>["/my/lib/path"]);
71
72 This should only be necessary if "/my/lib/path" is not in PERL5LIB.
73
74 Finally there is the 'default', and the related 'default_get' and
75 'default_set' options. These options control the "default" object
76 which is provided by the class interface to the methods. Setting
77 "default_get" to true tells the constructor to return the default
78 object if it is defined. Setting "default_set" to true tells the
79 constructor to make the default object the constructed object.
80 Setting the "default" option is like setting both to true. This is
81 used primarily internally and probably isn't interesting to any
82 real user.
83
84 modules()
85 This returns a list of the names of all the installed modules. The
86 perl 'core' is given the special name 'Perl'.
87
88 files()
89 This takes one mandatory parameter, the name of a module. It
90 returns a list of all the filenames from the package. To obtain a
91 list of core perl files, use the module name 'Perl'. Additional
92 parameters are allowed. The first is one of the strings "prog",
93 "doc" or "all", to select either just program files, just manual
94 files or all files. The remaining parameters are a list of
95 directories. The filenames returned will be restricted to those
96 under the specified directories.
97
98 directories()
99 This takes one mandatory parameter, the name of a module. It
100 returns a list of all the directories from the package. Additional
101 parameters are allowed. The first is one of the strings "prog",
102 "doc" or "all", to select either just program directories, just
103 manual directories or all directories. The remaining parameters
104 are a list of directories. The directories returned will be
105 restricted to those under the specified directories. This method
106 returns only the leaf directories that contain files from the
107 specified module.
108
109 directory_tree()
110 This is identical in operation to directories(), except that it
111 includes all the intermediate directories back up to the specified
112 directories.
113
114 validate()
115 This takes one mandatory parameter, the name of a module. It
116 checks that all the files listed in the modules .packlist actually
117 exist, and returns a list of any missing files. If an optional
118 second argument which evaluates to true is given any missing files
119 will be removed from the .packlist
120
121 packlist()
122 This returns the ExtUtils::Packlist object for the specified
123 module.
124
125 version()
126 This returns the version number for the specified module.
127
129 See the example in ExtUtils::Packlist.
130
132 Alan Burlison <Alan.Burlison@uk.sun.com>
133
134
135
136perl v5.12.4 2011-06-01 ExtUtils::Installed(3pm)