How do I start a new Perl module distribution?
makemaker, module, perl
Solution
Try this structure:
bin/Main.pl
lib/Utils/Util1.pm
lib/Utils/Util2.pm
Makefile.PL
MANIFEST
README
t/Utils1.t
t/Utils2.t
As ysth said, `make` does not install your modules, it just builds them in a `blib` directory. (In your case it just copies them there, but if you had XS code, it would be compiled with a C compiler.) Use `make install` to install your modules for regular scripts to use.
If you want to run your script between `make` and `make install`, you can do:
perl -Mblib bin/Main.pl
The `-Mblib` instructs perl to temporarily add the appropriate directories to the search path, so you can try out an uninstalled module. (`make test` does that automatically.)
Problem
I'm trying to set up a large-ish project, written in Perl. The IBM MakeMaker tutorial has been very helpful so far, but I don't understand how to link all the modules into the main program. In my project root, I have `MANIFEST`, `Makefile.PL`, `README`, a `bin` directory, and a `lib` directory. In my `bin` directory, I have my main script (`Main.pl`). In the `lib` directory, I have each of my modules, divided up into their own respective directories (i.e. `Utils::Util1` and `Utils::Utils2` in the `utils` directory, etc). In each module directory, there is also a `t` directory, containing tests My `MANIFEST` file has the following: ``` bin/Main.pl lib/Utils/Util1.pm lib/Utils/Util2.pm lib/Utils/t/Utils1.t lib/Utils/t/Utils2.t Makefile.PL MANIFEST README ``` `Makefile.PL` is the following: ``` use ExtUtils::MakeMaker; WriteMakefile( 'NAME'=>'Foo', 'VERSION_FROM'=>'bin/Main.pl', 'PREREQ_PM'=>{ "XML::Simple"=> 2.18}, #The libraries that we need and their #minimum version numbers 'EXE_FILES' =>[("bin/Main.pl")] ); ``` After I make and run, the program crashes, complaining that it cannot find `Utils::Util1`, and when I run '`make test`, it says `no tests defined`. Can anyone make any suggestions? I have never done a large scale project like this in perl, and I will need to add many more modules