brian d foy

NAME

extract_modules - determine which Perl modules a given file uses

SYNOPSIS

Given Perl files, extract and report the Perl modules included with use or require.

        # 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"
        ]

DESCRIPTION

This script does not execute the code in the files it examines. It uses the Module::Extract::Use or Module::ExtractUse modules which statically analyze the source without compiling or running it. These modules cannot discover modules loaded dynamically through a string eval.

AUTHORS

Jonathan Yu <frequency@cpan.org>

brian d foy <bdfoy@cpan.org>

COPYRIGHT & LICENSE

Copyright © 2009-2017, brian d foy <bdfoy@cpan.org>. All rights reserved.

You can use this script under the same terms as Perl itself.

SEE ALSO

Module::Extract::Use, Module::ExtractUse, Module::ScanDeps,

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