Building a Perl Project

What This Guide Covers

This guide covers build environment and configuration topics specific to Perl projects. Please make sure to read our Getting Started and general build configuration guides first.

Choosing Perl versions to test against

Perl workers on travis-ci.org use Perlbrew to provide several Perl versions your projects can be tested against. To specify them, use perl: key in your .travis.yml file, for example:

language: perl
perl:
  - "5.20"
  - "5.18"

A more extensive example:

language: perl
perl:
  - "5.20"
  - "5.18"
  - "5.16"
  - "5.14"

As time goes, new releases come out and we upgrade both Perlbrew and Perls, aliases like 5.14 will float and point to different exact versions, patch levels and so on. For full up-to-date list of provided Perl versions, see our CI environment guide.

Perl versions earlier than 5.8 are not and will not be provided. Please do not list them in .travis.yml.

Perl runtimes with -Duseshrplib

Additionally, Perl 5.18 and 5.20 with -Duseshrplib are available as 5.20-shrplib and 5.18-shrplib, respectively.

Default Perl Version

If you leave the perl key out of your .travis.yml, Travis CI will use Perl 5.14.

Default Test Script

Module::Build

If your repository has Build.PL in the root, it will be used to generate the build script:

perl Build.PL && ./Build test

EUMM

If your repository has Makefile.PL in the root, it will be used like so

perl Makefile.PL && make test

If neither Module::Build nor EUMM build files are found, Travis CI will fall back to running

make test

It is possible to override test command as described in the general build configuration guide.

Dependency Management

Travis CI uses cpanm

By default Travis CI use cpanm to manage your project's dependencies. It is possible to override dependency installation command as described in the general build configuration guide.

The exact default command is

cpanm --quiet --installdeps --notest .

When Overriding Build Commands, Do Not Use sudo

When overriding install: key to tweak dependency installation command (for example, to run cpanm with verbosity flags), do not use sudo. Travis CI Environment has Perls installed via Perlbrew in non-privileged user $HOME directory. Using sudo will result in dependencies being installed in unexpected (for Travis CI Perl builder) locations and they won't load.

Build Matrix

For Perl projects, env and perl can be given as arrays to construct a build matrix.

Environment Variable

The version of Perl a job is using is available as:

TRAVIS_PERL_VERSION

Examples