NAME
App::CpanDak - cpanm, with some sort of distroprefs
VERSION
version 0.1.0
SYNOPSIS
cpandak Foo::Bar
cpandak --installdeps .
Exactly the same way as cpanm.
DESCRIPTION
This is a subclass of App::cpanminus::script that wraps some of its methods to add the ability to apply patches, set environment variables, and skip tests, to specific distributions.
The idea comes from Distroprefs.
Warning
This is mostly a hack; it will not work on cpanminus 1.79 or later (those future versions are a complete rewrite, based on Menlo).
Special instructions
You add special instructions in a directory, then set the full path to that directory in the PERL_CPANDAK_SPECIALS_PATH environment variable.
Files should be named after the full name of the distribution they apply to, with optional full version. So to define a patch for all versions of Test-mysqld, you create $PERL_CPANDAK_SPECIALS_PATH/Test-mysqld.patch. To define test environment variables for version 1.2.3 of Foo-Bar you create $PERL_CPANDAK_SPECIALS_PATH/Foo-Bar-1.2.3.test.env.yml.
NOTE the use of dash, not double colon! It's a distribution name, not a module name!
These files are currently supported:
.patch-
unified patch to apply to the distribution contents immediately after unpacking (it is applied by calling
patch -p1)the main use of this is for fixing a distribution while you wait for the author to release a fixed version; another good use is to make changes to a distribution to adapt it to your particular runtime environment
.options.yml-
general processing options:
notest-
Perl-style boolean, if true, no tests will be run for this distribution
--- notest: 1 add_version_spec-
version specification that will be added to the requirements for this distribution (but see "Additional Version Specifications" for details).
--- add_version_spec: "> 0.9.3, != 1.1.0"
.configure.env.yml.build.env.yml.test.env.yml.install.env.yml-
environment variables to set before running running those phases
--- TMP_SOCKET_PATH: '/tmp/' SKIP_NETWORK: '1' PLACK_ENV: ~ # remove this variable from the environment
See also App::CpanDak::Specials.
Additional Version Specifications
As far as Perl is concerned, modules carry versions, distributions don't (mainly because neither Perl-the-language nor perl-the-runtime know what a distribution is).
CPAN distributions do carry versions, though, and while most recent distributions have the same version as all the modules they contain, this is never guaranteed.
So, adding version specifications at the distribution level is just not going to work reliably.
When asked to install a module (possibly with some version specification of its own), this application does the following:
find the distribution that contains the module (with a version that satisfies the specification)
find the
.options.ymlfile matching that distributionget the
add_version_specvalue from it, for the module we're installing (see below)combine the original version specification with this additional one
if the module we found satisfies the combined specification, use it
otherwise, find a distribution that contains the module with a version that satisfies the combined specification
Notice that the process is not recursive: we search at most twice.
add_version_spec can be a string, or a dictionary mapping module names to strings:
if it's a string, it's used for any module found in that distribution
if it's a dictionary, the value for the module we're installing is used
unless there's no such value, in which case we use the value for
*
So, in specials/ACME-Example.options.yml:
add_version_spec: "== 1.0.0"
would pin all modules found in the ACME-Example distribution to version 1.0.0,
add_version_spec:
"*": "== 1.0.0"
would do the same,
add_version_spec:
"ACME::Example::Weird": "== 1.0.0"
would only pin the ACME::Example::Weird module, so if we're asked to install ACME::Example::Plain, we'd install the latest version of the distribution.
When would this be useful? Module-Release-2.136 contains Module::Release 2.136 and Module::Release::MetaCPAN 2.131, so if you wanted to pin that distribution regardless of which of its modules is requested, you would need to write a Module-Release.options.yml containing:
add_version_spec:
"Module::Release": "== 2.136"
"*": "== 2.131"
AUTHOR
Gianni Ceccarelli <dakkar@thenautilus.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Gianni Ceccarelli <dakkar@thenautilus.net>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.