The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

  DistroPrefs -- Preferences/Distributions/CPAN

DESCRIPTION

The files in this directory are YAML files that specify how CPAN.pm shall treat distributions that deviate from the normal model of

    perl Makefile.PL
    make
    make test
    make install

Some modules try to get some data from the user interactively thus disturbing the installation of large bundles like Phalanx100 or modules like Plagger.

CPAN.pm can use these YAML files to either pass additional arguments to one of the four commands, set environment variables or instantiate an Expect object that reads from the console, waits for some regular expression and enters some answer. Additionally, the YAML files can temporarily override the CPAN.pm configuration variables (at the time of this writing not all of them).

Many of the files that come with the CPAN.pm distribution contain more fields than necessary so they can easier be used as blueprints. In practice all empty fields can be removed from the YAML files. To find a blueprint pick one of the larger files.

FILENAMES

The YAML files themselves must have the .yml extension, all other files are ignored. The containing directory can be specified in CPAN.pm in the prefs_dir config variable. Try 'o conf init /prefs/' in the CPAN shell.

The names of the files can be picked freely, CPAN.pm always reads all files (in alphabetical order) and takes the key "match" as a hashref containing one or both of the keys distribution or modules. The corresponding values are interpreted as regular expressions. The distribution related one will be matched against the canonical distribution name, e.g. "AUTHOR/Foo-Bar-3.14.tar.gz". The module related one will be matched against all modules contained in the distribution. The module matches will be ORed which means that for a module related match it is enough when one module matches. As there is only one name for the current distribution, a distribution match can only be achieved if the name of the current distribution matches. If both module and distribution is specified, the two separately computed match values are ANDed. If the final result is true, then the hashref represented by the YAML file is returned as the preference structure for the current distribution.

MAINTAINANCE

Authors are changing their packages and introduce new dialogs, change the wording, change the order of questions, remove questions, introduce new options, update their autoinstaller etc. So you have to adjust your prefs from time to time. While CPAN.pm will probably contain some newer prefs files with every release, it will never be a reliable data source for a large amount of prefs file and more importantly will not always match your requirements.

So if you decide to use distroprefs do not expect that you can have them without some maintainance overhead.

TRICKS

Repetitions

Distros using older versions of Module::AutoInstall often do not support the --defaultdeps argument. So you probably have to use

  pl:
    expect:
      - "Auto-install"
      - "y\n"

When you watch them you probably notice that they ask one question. Don't rely on that number. Next time you install that module it may ask 2 or more questions: because it calculates the number of questions from what you have installed at the moment. So better be prepared for more questions and repeat the above pattern once or twice.

Don't hesitate to report this as a bug to the module author that is using Module::AutoInstall. They have to update the copy of Module::AutoInstall that comes with their package. It will not be sufficient that you update Module::AutoInstall.

Exceptions

You have a Bundle to install and notice that the Bundle has one module that you do NOT want for some reason? Add something like

  make: 
    args:
      - nosuchtarget

and you force this target to fail quickly.

Fun (not!)

Module::AutoInstall often doesn't get it right to find out under which circumstances it was invoked. Setting the environment variable PERL5_CPANPLUS_IS_RUNNING to 1 or setting PERL_AUTOINSTALL to --skip seems to help. Best to try both. I do not understand what's up there. If you know, please fix. If you don't, maybe try what I'm doing in MIYAGAWA.Plagger.yml.

FEEDBACK

Please report the improvements you apply to these files. Any additions and corrections are welcome. Also, please be aware that there are many areas of this system that need further attention and are not yet working as one would expect or hope.

Please use the http://rt.cpan.org/Dist/Display.html?Status=Active&Queue=CPAN address to report any bugs and wished. Thank you!

Enjoy, -- andreas