Last Updated: February 25, 2016
·
414
· stevenl

Putting a Travis badge in your Pod::Weaver document

So I recently got my Dzil-managed distribution to build on Travis CI. Now I wanted to put the badge in the Pod under the module name.

The normal way for putting it into your Pod is to add these lines:

=for html
<a href="https://travis-ci.org/stevenl/Test-Mocha"><img src="https://travis-ci.org/stevenl/Test-Mocha.svg?branch=master" alt="Build Status"></a>

The problem with this is I use Pod::Weaver which moves that into the [Leftovers] section, at the bottom of the document. This article suggested moving Leftovers to the top. But then my problem was that Leftovers was already being used for other parts of my document.

My solution was to create a new region in weaver.ini named badge:

[Name]
[Region / badge]
[Version]

Then in my Pod I had:

=for :badge
=for html
<a href="https://travis-ci.org/stevenl/Test-Mocha"><img src="https://travis-ci.org/stevenl/Test-Mocha.svg?branch=master" alt="Build Status"></a>

And Pod::Weaver will put that in the badge region.