Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

module::extract::use(3pm) [debian man page]

Module::Extract::Use(3pm)				User Contributed Perl Documentation				 Module::Extract::Use(3pm)

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 ); if( $extor->error ) { ... } my @details = $extor->get_modules_with_details( $file ); foreach my $detail ( @details ) { printf "%s %s imports %s ", $detail->module, $detail->version, join ' ', @{ $detail->imports } } 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. init Set up the object. You shouldn't need to call this yourself. 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. 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. get_modules_with_details( FILE ) Returns a list of hash references, one reference for each namespace explicitly use-d in FILE. Each reference has keys for: namespace - the namespace, always defined version - defined if a module version was specified imports - an array reference to the import list 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. error Return the error from the last call to "get_modules". TO DO
o Make it recursive, so it scans the source for any module that it finds. SEE ALSO
Module::ScanDeps SOURCE AVAILABILITY
The source code is in Github: git://github.com/briandfoy/module-extract-use.git AUTHOR
brian d foy, "<bdfoy@cpan.org>" COPYRIGHT AND LICENSE
Copyright (c) 2008-2011, brian d foy, All Rights Reserved. You may redistribute this under the same terms as Perl itself. perl v5.10.1 2011-03-31 Module::Extract::Use(3pm)

Check Out this Related Man Page

Test::Without::Module(3pm)				User Contributed Perl Documentation				Test::Without::Module(3pm)

NAME
Test::Without::Module - Test fallback behaviour in absence of modules SYNOPSIS
use Test::Without::Module qw( My::Module ); # Now, loading of My::Module fails : eval { require My::Module; }; warn $@ if $@; # Now it works again eval q{ no Test::Without::Module qw( My::Module ) }; eval { require My::Module; }; print "Found My::Module" unless $@; DESCRIPTION
This module allows you to deliberately hide modules from a program even though they are installed. This is mostly useful for testing modules that have a fallback when a certain dependency module is not installed. EXPORT None. All magic is done via "use Test::Without::Module LIST" and "no Test::Without::Module LIST". Test::Without::Module::get_forbidden_list This function returns a reference to a copy of the current hash of forbidden modules or an empty hash if none are currently forbidden. This is convenient if you are testing and/or debugging this module. ONE LINER
A neat trick for using this module from the command line was mentioned to me by NUFFIN and by Jerrad Pierce: perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t That way, you can easily see how your module or test file behaves when a certain module is unavailable. BUGS
o There is no lexical scoping CREDITS
Much improvement must be thanked to Aristotle from PerlMonks, he pointed me to a much less convoluted way to fake a module at <http://www.perlmonks.org/index.pl?node=192635>. I also discussed with him an even more elegant way of overriding CORE::GLOBAL::require, but the parsing of the overridden subroutine didn't work out the way I wanted it - CORE::require didn't recognize barewords as such anymore. NUFFIN and Jerrad Pierce pointed out the convenient use from the command line to interactively watch the behaviour of the test suite and module in absence of a module. AUTHOR
Copyright (c) 2003-2009 Max Maischein, <corion@cpan.org> LICENSE
This module is released under the same terms as Perl itself. SEE ALSO
Devel::Hide, Acme::Intraweb, PAR, perlfunc perl v5.10.0 2009-01-18 Test::Without::Module(3pm)
Man Page