New To CPAN Development - Test-More/test-more GitHub Wiki
If you've never patched a Perl module before, this is a guide to help you get your Perl development environment setup and learn how to work with a Perl module out of its repository.
Generally useful links for those new to Perl
- http://learn.perl.org/ has all the basics for those new to Perl.
- chromatic's Modern Perl book is free and a great introduction to programmer Perl for reals.
Setting up your Perl development environment
Unlike most CPAN modules, Test::More has no dependencies. It should work fine with the Perl that comes with your operating system with no further setup. If you're on Windows, we recommend Strawberry Perl or the Perl which comes with Cygwin.
Getting the code
For a module on Github, you'll have to clone
the git repository to get a copy of the code. Please see help.github.com for more information. We also recommend the free Pro Git book written by one of the Github folks.
Satisfying the dependencies
Test::More has no dependencies, so there should be nothing to do here.
Make sure it works
Before you start developing, it's good to make sure the code in the repository works. It's rare for it to be broken, but it's a simple, quick step to make sure.
-
Run
perl Makefile.PL
to generate the Makefile. -
Run
make test
to build the project and run the its tests
Strawberry Perl users will use dmake
instead of make
. It comes with Strawberry.
Running the tests
While you're developing, you're going to want to run individual tests. Perl tests are just like any other Perl program with one key difference. You have to make sure the test program loads the version of the module sitting in your source directory and not one which you may have installed.
There's three ways to do this.
-
make test
will do it for you, but it runs the whole test suite which often isn't what you want while developing. -
prove -l t/foo.t
will run a single test. The-l
flag tells it to use the Perl modules inlib/
first. You can also pass it the-v
flag to see the exact output of the test rather than the summary provided by prove. -
perl -Ilib t/foo.t
will run a single test, raw. This is the most flexible way of running the tests while developing, but it does not provide the nice summary like prove.-Ilib
tellsperl
to look inlib/
first for modules. If you're comfortable with a debugger, you can add-d
to debug the test and your changes.
For most Perl modules it is not necessary to rebuild the project between changes.