The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Module::Extract::Use - Pull out the modules a module uses

SYNOPSIS

        use Module::Extract::Use;

        my $extor = Module::Extract::Use->new;
        
        my @modules = $extor->get_modules( $file );
        
        

DESCRIPTION

Extract the names of the modules used in a file using a static analysis. Since this module does not run code, it cannot find dynamic uses of modules, such as eval "require $class".

new

Makes an object. The object doesn't do anything just yet, but you need it to call the methods.

get_modules( FILE )

Returns a list of namespaces explicity use-d in FILE. Returns undef if the file does not exist or if it can't parse the file.

TO DO

* Make it recursive, so it scans the source for any module that it finds.

SEE ALSO

Module::ScanDeps

SOURCE AVAILABILITY

I have a git archive for this. If you'd like to clone it, just ask.

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2008, brian d foy, All Rights Reserved.

You may redistribute this under the same terms as Perl itself.