NAME
Module::Install::TemplateInstallPath - templatize installation paths
SYNOPSIS
use inc::Module::Install;
name 'Your-Module';
all_from 'lib/Your/Modulepm';
template_install_path( \%options );
DESCRIPTION
This Module::Install plugin rewrites command line arguments of the form
<variable>=<template>
where <variable>
is one of
INSTALL_BASE PREFIX LIB
(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 recognized tokens may be augmented or overridden.
Functions
- template_install_path
-
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()
orversion()
, etc), but beforeWriteAll
(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.
DIAGNOSTICS
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-module-install-graft@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Install-TemplateInstallPath.
SEE ALSO
VERSION
Version 0.01
LICENSE AND COPYRIGHT
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 <http://www.gnu.org/licenses/>.
AUTHOR
Diab Jerius <djerius@cpan.org>