Building a Perl Project

What This Guide Covers #

For Language versions and other build-environment specific information visit our reference pages:

Perl builds are not available on the OS X environment.

The rest of this guide covers configuring Perl projects in Travis CI. If you’re new to Travis CI please read our Getting Started and build configuration guides first.

Specifying Perl versions #

Travis CI uses Perlbrew to provide several Perl versions you can test your projects against:

language: perl
  - "5.30"
  - "5.28"
  - "5.26"

These versions specified by major.minor numbers are aliases to exact patch levels, which are subject to change. For precise versions pre-installed on the VM, please consult “Build system information” in the build log.

Perl versions earlier than 5.8 are not supported.

Perl runtimes with threading support #

Some Perls have been compiled with threading support. They have been compiled with the additional compile flags -Duseshrplib and -Duseithreads:


Default Build Script #

The default build script varies according to your project:

  • if your repository has Build.PL in the root:

    perl Build.PL && ./Build test
  • if your repository has Makefile.PL in the root:

    perl Makefile.PL && make test
  • if neither is found:

    make test

Dependency Management #

By default Travis CI use cpanm to manage your project’s dependencies.

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’s $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 Variables #

The version of Perl a job is using is available as TRAVIS_PERL_VERSION.

Build Config Reference #

You can find more information on the build config format for Perl in our Travis CI Build Config Reference.

Examples #