Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add multiple Perl modules to Makefile.PL?

Tags:

perl

makemaker

Looking for some insight on how to add multiple PM files to the MakeMaker script?

I see this documentation and all the examples look like one file is added, how do I add multiple files?

use ExtUtils::MakeMaker;

WriteMakefile(
   NAME => 'Your::Module',
   VERSION_FROM => 'lib/Your/Module.pm'
);

Do I just add another set of values?

use ExtUtils::MakeMaker;

WriteMakefile(
   NAME => 'Your::Module',
   VERSION_FROM => 'lib/Your/Module.pm'

   NAME => 'Your::Module2',
   VERSION_FROM => 'lib/Your/Module2.pm'
);
like image 563
Phill Pafford Avatar asked Jan 18 '26 06:01

Phill Pafford


2 Answers

The answer is: do nothing. Your original code and layout is fine. MakeMaker will find your modules in lib without you lifting a finger. Try it and see.

Explicitly writing out PM as in toolic's answer is unnecessary and brittle.

like image 79
Schwern Avatar answered Jan 21 '26 01:01

Schwern


toolic's answer already points you to the docs, but I'll answer the other part of the question (although it is also in the docs):

NAME is the string Makemaker uses for the distribution name. Although this is often the main module, it can really be anything you like.

VERSION_FROM tells Makemaker that it should take the $VERSION from a specific file and use that at the distribution version. Most often, people use the version of the main module as the distribution version, but you don't have to do that.

like image 33
brian d foy Avatar answered Jan 21 '26 02:01

brian d foy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!