NAME
Dependencies::Searcher - Search recursively dependencies used in a module's directory and build a report that can be used as a Carton cpanfile.
SYNOPSIS
Maybe you don't want to have to list all the dependencies of your application by hand, or maybe you forgot to do it for a long time ago. During this time, you've add lots of CPAN modules. Carton is here to help you manage dependencies between your development environment and production, but how to keep track of the list of modules you will give to Carton?
You will need a tool that will check for any 'requires' or 'use' in your module package, and report it into a file that could be used as a Carton cpanfile. Any duplicated entry will be removed and versions are available.
This project has begun because it happens to me, and I don't want to search for modules to install, I just want to run a simple script that update the list in a simple way.
use Dependencies::Searcher;
my $searcher = Dependencies::Searcher->new();
my @elements = $searcher->get_files();
my $path = $searcher->build_full_path(@elements);
my @uses = $searcher->get_modules($path, "use");
my @uniq_modules = $searcher->uniq(@uses);
$searcher->dissociate(@uniq_modules);
$searcher->generate_report($searcher->non_core_modules);
SUBROUTINES/METHODS
This is work in progress...
get_modules
Us-e Ack to get modules and store lines into arrays
get_files
build_full_path
Retrieve names of : * lib/ directory, if it don't exist, we don't care and die * Makefile.PL * script/ directory, if we use a Catalyst application * ... only if they exists !
merge_dependencies
Merge use and requires
make_it_real
Remove special cases that can't be interesting.
clean_everything
Remove everything but the module name. Remove dirt, clean stuffs...
uniq
Make each array element uniq
dissociate
Dissociate core / non-core modules
generate_report
Generate the cpanfile for Carton, with optionnal version number
AUTHOR
smonff, <smonff at gmail.com>
BUGS
Please report any bugs or feature requests to bug-dependencies-searcher at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dependencies-Searcher. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
TODOs
https://github.com/smonff/dependencies-searcher/issues
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Dependencies::Searcher
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dependencies-Searcher
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
Brian D. Foy's Module::Extract::Use
Was the main inspiration for this one. First, I want to use it for my needs but is was not recursive...
Module::CoreList
What modules shipped with versions of perl. I use it extensively to detect if the module is from Perl Core or not.
Andy Lester's Ack
I've use it as the main source for the module. It was pure Perl so I've choose it, even if Ack is not meant for being used programatically, this use do the job.
See also https://metacpan.org/module/Perl::PrereqScanner http://stackoverflow.com/questions/17771725/
LICENSE AND COPYRIGHT
Copyright 2013 smonff.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.