1Find(3) User Contributed Perl Documentation Find(3)
2
3
4
6 Module::Find - Find and use installed modules in a (sub)category
7
9 use Module::Find;
10
11 # use all modules in the Plugins/ directory
12 @found = usesub Mysoft::Plugins;
13
14 # use modules in all subdirectories
15 @found = useall Mysoft::Plugins;
16
17 # find all DBI::... modules
18 @found = findsubmod DBI;
19
20 # find anything in the CGI/ directory
21 @found = findallmod CGI;
22
23 # set your own search dirs (uses @INC otherwise)
24 setmoduledirs(@INC, @plugindirs, $appdir);
25
26 # not exported by default
27 use Module::Find qw(ignoresymlinks followsymlinks);
28
29 # ignore symlinks
30 ignoresymlinks();
31
32 # follow symlinks (default)
33 followsymlinks();
34
36 Module::Find lets you find and use modules in categories. This can be
37 very useful for auto-detecting driver or plugin modules. You can
38 differentiate between looking in the category itself or in all
39 subcategories.
40
41 If you want Module::Find to search in a certain directory on your
42 harddisk (such as the plugins directory of your software installation),
43 make sure you modify @INC before you call the Module::Find functions.
44
46 "setmoduledirs(@directories)"
47 Sets the directories to be searched for modules. If not set,
48 Module::Find will use @INC. If you use this function, @INC will not
49 be included automatically, so add it if you want it. Set to undef
50 to revert to default behaviour.
51
52 "@found = findsubmod Module::Category"
53 Returns modules found in the Module/Category subdirectories of your
54 perl installation. E.g. "findsubmod CGI" will return
55 "CGI::Session", but not "CGI::Session::File" .
56
57 "@found = findallmod Module::Category"
58 Returns modules found in the Module/Category subdirectories of your
59 perl installation. E.g. "findallmod CGI" will return "CGI::Session"
60 and also "CGI::Session::File" .
61
62 "@found = usesub Module::Category"
63 Uses and returns modules found in the Module/Category
64 subdirectories of your perl installation. E.g. "usesub CGI" will
65 return "CGI::Session", but not "CGI::Session::File" .
66
67 If any module dies during loading, usesub will also die at this
68 point.
69
70 "@found = useall Module::Category"
71 Uses and returns modules found in the Module/Category
72 subdirectories of your perl installation. E.g. "useall CGI" will
73 return "CGI::Session" and also "CGI::Session::File" .
74
75 If any module dies during loading, useall will also die at this
76 point.
77
78 "ignoresymlinks()"
79 Do not follow symlinks. This function is not exported by default.
80
81 "followsymlinks()"
82 Follow symlinks (default behaviour). This function is not exported
83 by default.
84
86 0.01, 2004-04-22
87 Original version; created by h2xs 1.22
88
89 0.02, 2004-05-25
90 Added test modules that were left out in the first version.
91 Thanks to Stuart Johnston for alerting me to this.
92
93 0.03, 2004-06-18
94 Fixed a bug (non-localized $_) by declaring a loop variable in
95 use functions. Thanks to Stuart Johnston for alerting me to
96 this and providing a fix.
97
98 Fixed non-platform compatibility by using File::Spec. Thanks
99 to brian d foy.
100
101 Added setmoduledirs and updated tests. Idea shamelessly stolen
102 from ...errm... inspired by brian d foy.
103
104 0.04, 2005-05-20
105 Added POD tests.
106
107 0.05, 2005-11-30
108 Fixed issue with bugfix in PathTools-3.14.
109
110 0.06, 2008-01-26
111 Module::Find now won't report duplicate modules several times
112 anymore (thanks to Uwe Völker for the report and the patch)
113
114 0.07, 2009-09-08
115 Fixed RT#38302: Module::Find now follows symlinks by default
116 (can be disabled).
117
118 0.08, 2009-09-08
119 Fixed RT#49511: Removed Mac OS X extended attributes from
120 distribution
121
122 0.09, 2010-02-26
123 Fixed RT#38302: Fixed META.yml generation (thanks very much to
124 cpanservice for the help).
125
126 0.10, 2010-02-26
127 Fixed RT#55010: Removed Unicode BOM from Find.pm.
128
129 0.11, 2012-05-22
130 Fixed RT#74251: defined(@array) is deprecated under Perl
131 5.15.7. Thanks to Roman F, who contributed the implementation.
132
133 0.12, 2014-02-08
134 Fixed RT#81077: useall fails in taint mode Thanks to Aran
135 Deltac, who contributed the implementation and test.
136
137 Fixed RT#83596: Documentation doesn't describe behaviour if a
138 module fails to load Clarified documentation for useall and
139 usesub.
140
141 Fixed RT#62923: setmoduledirs(undef) doesn't reset to searching
142 @INC Added more explicit tests. Thanks to Colin Robertson for
143 his input.
144
145 0.13, 2015-03-09
146 This release contains two contributions from Moritz Lenz:
147
148 Link to Module::Pluggable and Class::Factory::Util in "SEE
149 ALSO"
150
151 Align package name parsing with how perl does it (allowing
152 single quotes as module separator)
153
154 Also, added a test for meta.yml
155
156 0.14, 2019-12-25
157 A long overdue update. Thank you for the many contributions!
158
159 Fixed RT#99055: Removed file readability check (pull request
160 contributed by Moritz Lenz)
161
162 Now supports @INC hooks (pull request contributed by Graham
163 Knop)
164
165 Now filters out filenames starting with a dot (pull request
166 contributed by Desmond Daignault)
167
168 Now uses strict (pull request contributed by Shlomi Fish)
169
170 Fixed RT#122016: test/ files show up in metacpan (bug report
171 contributed by Karen Etheridge)
172
173 0.15, 2019-12-26
174 Fixed RT#127657 (bug report contributed by Karen Etheridge):
175 Module::Find now uses @ModuleDirs (if specified) for loading
176 modules. Previously, when using setmoduledirs() to set an array
177 of directories that did not contain @INC, Module::Find would
178 find the modules correctly, but load them from @INC.
179
181 Please report any bugs using the CPAN RT system. The development
182 repository for this module is hosted on GitHub:
183 <http://github.com/crenz/Module-Find/>.
184
186 perl, Module::Pluggable, Class::Factory::Util
187
189 Christian Renz, <crenz@web42.com>
190
192 Copyright 2004-2019 by Christian Renz <crenz@web42.com>. All rights
193 reserved.
194
195 This library is free software; you can redistribute it and/or modify it
196 under the same terms as Perl itself.
197
198
199
200perl v5.34.0 2022-01-21 Find(3)