The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Module::Install::TemplateInstallPath - templatize installation paths


    use inc::Module::Install;

    name 'Your-Module';
    all_from 'lib/Your/Modulepm';

    template_install_path( \%options );


This Module::Install plugin rewrites command line arguments of the form


where <variable> is one of


(case is not significant and <variable> is rewritten in upper case).

Any of the following tokens found in <template> is replaced by its associated value:


The name of the module


The version of the module

The recognized tokens may be augmented or overridden.


  template_install_path( \%options );

This function will process the command line. It should be run after information about the module is provided to Module::Install (e.g. via name() or version(), etc), but before WriteAll (or equivalent).

The following options are recognized:

template template

This specifies a template to be used if the value passed on the command line is unchanged after processing (implying it contained no template tokens).

If the catdir option is true, the results of filling in this template are appended to the value on the commandline using File::Spec::Functions::catdir.

catdir boolean

See template for what this does. It defaults to true.

tokens hashref

This specifies a hash containing tokens and their values. Tokens must be the exact string which will be replaced. Token values may be a scalar or a code reference. In the latter case they will be passed a reference to the Module::Install object. For example, here is how the default tokens are specified:

      '%n' => sub { $_[0]->name },
      '%v' => sub { $_[0]->version  },

To override a token, just provide a new value for it. To delete a token, set it to the undefined value.


%s: no value specified

The named variableC was specified without a value.


No bugs have been reported.

Please report any bugs or feature requests to, or through the web interface at




Version 0.01


Copyright (c) 2011 The Smithsonian Astrophysical Observatory

Module::Install::TemplateInstallPath is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.


Diab Jerius <>