smonff
smonff

Reputation: 3499

How to manage the installation of modules used by an open source Perl project?

I work on a small open-source Perl project with Catalyst, Open Street Map and dozens of modules. I try to use as many modules found on the CPAN as I can because my aim is not to reinvent the wheel.

All this stuff has been installed through cpanm and local::lib. Each time I need something new I install a couple of modules and dependencies (it's so simple with cpanm). Now, I'm asking myself how people who will clone my project could install the dozens of module without an horrible headache-of-death?

What are the best practices for this? I am supposed to list all required modules into Makefile.pl? I feel now anxious about this because I worked hard on this project, try to follow a lot of good practices, but feel I commit a mistake on this particular point (for not think about this).

I need some advice about this problem because everything seems so magic that I don't believe that it's enough to list the modules names in the Makefile with the 'require' keyword. I hope too it's not necessary to include all dependencies in the project and commit all this huge package for later uses.

Upvotes: 7

Views: 304

Answers (3)

Edward
Edward

Reputation: 486

You should only list (in Makefile.PL) those modules that you require directly (i.e., the ones that you use or require in your modules). You don't need to worry about the modules that are required indirectly (i.e., by the modules you use); that is the job of the installer.

To get a list of the modules you use, you could of course compile the list manually. But if you happen to have The Definitive Guide to Catalyst, there is a handy Bash function on page 129, which I'm not sure I can reproduce here. There is also Perl::PrereqScanner::App, which I haven't used directly, but which is used by Dist::Zilla.

FWIW, if you use Dist::Zilla to manage your distribution (which I do even for private projects that I don't upload to CPAN), it can (and does by default) track dependencies for you.

Upvotes: 1

tjmw
tjmw

Reputation: 309

I'd recommend taking a peek at carton (from the same author as the awesome cpanm).

I'm a big fan of Ruby's bundler and carton's documentation describes it as "Bundler for Perl". I experimented with it a while back and it looked very promising.

Upvotes: 1

Julien
Julien

Reputation: 5779

If you use Catalyst, you can add the modules you need as dependencies in the Makefile.PL created for your Catalyst application.

Upvotes: 4

Related Questions