extract_modules - determine which Perl modules a given file uses
Given Perl files, extract and report the Perl modules included with
# print a verbose text listing $ extract_modules filename [...] Modules required by examples/extract_modules: - Getopt::Std (first released with Perl 5) - Module::CoreList (first released with Perl 5.008009) - Pod::Usage (first released with Perl 5.006) - strict (first released with Perl 5) - warnings (first released with Perl 5.006) 5 module(s) in core, 0 external module(s) # print a succint list, one module per line $ extract_modules -l filename [...] Getopt::Std Module::CoreList Pod::Usage open strict warnings # print a succinct list, modules separated by null bytes # you might like this with xargs -0 $ extract_modules -0 filename [...] Getopt::StdModule::CoreListPod::Usageopenstrictwarnings # print the modules list as JSON $ extract_modules -j filename [...] [ "Getopt::Std", "Module::CoreList", "Pod::Usage", "open", "strict", "warnings" ]
This script does not execute the code in the files it examines. It uses the
Module::ExtractUse modules which statically analyze the source without compiling or running it. These modules cannot discover modules loaded dynamically through a string eval.
brian d foy
Copyright © 2009-2017, brian d foy <email@example.com>. All rights reserved.
You can use this script under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 170:
Non-ASCII character seen before =encoding in '©'. Assuming UTF-8