Module::Extract::Use(3pm) | User Contributed Perl Documentation | Module::Extract::Use(3pm) |
Module::Extract::Use - Pull out the modules a module explicitly uses
use Module::Extract::Use; my $extor = Module::Extract::Use->new; my @modules = $extor->get_modules( $file ); if( $extor->error ) { ... } my $details = $extor->get_modules_with_details( $file ); foreach my $detail ( @$details ) { printf "%s %s imports %s\n", $detail->module, $detail->version, join ' ', @{ $detail->imports } }
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"". It only reports modules that the file loads directly. Modules loaded with "parent" or "base", for instance, will will be in the import list for those pragmas but won't have separate entries in the data this module returns.
Each used namespace is only in the list even if it is used multiple times in the file. The order of the list does not correspond to anything so don't use the order to infer anything.
namespace - the namespace, always defined version - defined if a module version was specified imports - an array reference to the import list pragma - true if the module thinks this namespace is a pragma
Each used namespace is only in the list even if it is used multiple times in the file. The order of the list does not correspond to anything so don't use the order to infer anything.
Module::ScanDeps
The source code is in Github:
git://github.com/briandfoy/module-extract-use.git
brian d foy, "<bdfoy@cpan.org>"
Copyright © 2008-2017, brian d foy "<bdfoy@cpan.org>". All rights reserved.
This project is under the Artistic License 2.0.
2018-01-02 | perl v5.26.1 |