smonff
smonff

Reputation: 3497

Auto-add 'requires' lines to Makefile.PL from dependencies used in a Catalyst application

I've developed a Catalyst application without having regularly added dependencies to Makefile.PL using the requires 'Module::Foo'; way. It was not a problem during development, but now I have to deploy. I have used a lot of modules, it is a pain to do this work.

Is there a common way to parse all the .pm files in lib directory and write it to the Makefile.PL? Is there a reason that each time we use a module, it is not automatically added to the Makefile.PL?

Does somebody would know a kind of Catalyst Helper or anything else that could make the job?

Upvotes: 0

Views: 325

Answers (3)

smonff
smonff

Reputation: 3497

For simpler use case, @climagic recommends :

grep -rh ^use --include="*.pl" --include="*.pm" . | sort | uniq -c

as a solution which is not perfect, but gives you a start on the Perl modules in use.

Upvotes: 0

KeepCalmAndCarryOn
KeepCalmAndCarryOn

Reputation: 9075

You can use Dist::Zilla which has a plugin to detect your prerequisites

http://dzil.org/tutorial/prereq.html

Or you could roll your own and grep your code for use and require statements.

Upvotes: 0

Related Questions