Skip to content

MakeMaker targets ​

Options to customise the output can be added to Makefile.PL in META_MERGE.x_documentation.publish section, e.g.

perl
use 5.008;
use strict;
use warnings;
use ExtUtils::MakeMaker;

#  Optional way to include Markdown::Publish targets without needing
#  to run 'perl -MASPEER::MakeMaker::Markdown::Publish Makefile.PL'
#  every time. This will include Makefile targets if the module is 
#  available on the system, or continue silently if not
#
eval {
    require ASPEER::MakeMaker::Markdown::Publish;
    ASPEER::MakeMaker::Markdown::Publish->import();
    1;
};

WriteMakefile(
    NAME         => 'Example::Client',
    VERSION_FROM => 'lib/Example/Client.pm',
    META_MERGE   => {
        'meta-spec' => {version => 2},
        x_documentation => {
            publish => {
                module  => 'mkdocs',
                name    => 'Example::Client',
                sources => ['doc'],
            },
        },
    },
);

Publisher settings and preferences can also be set with environment variables (see section below).

Regenerate the Makefile after changing Makefile.PL as changing an inline setting also requires regeneration.

sh
perl Makefile.PL
make doc
make publish_serve

When name is omitted, the MakeMaker adapter uses the distribution's NAME as the documentation title. MkDocs is the default engine, so both module and name can be omitted in this example. Keeping them visible is useful in a template because it makes the intended site clear.