This plugin provides a mechanism for specifying prerequisites for optional features in metadata, which should cause CPAN clients to interactively prompt you regarding these features at install time (assuming interactivity is turned on: e.g. cpanm --interactive Foo::Bar).

The feature name and description are required. The name can be extracted from the plugin name.

You can specify requirements for different phases and relationships with:

It is possible that future versions of this plugin may allow a more compact way of providing sophisticated prerequisite specifications.

If the plugin name is the CamelCase concatenation of a phase and relationship (or just a relationship), it will set those parameters implicitly. If you use a custom name, but it does not specify the relationship, and you didn't specify either or both of -phase or -relationship, these values default to runtime and requires respectively.

The example below is equivalent to the synopsis example above, except for the name of the resulting plugin:

NOTE: It is advised that you only specify one prerequisite for a given feature -- and if necessary, create a separate distribution to encapsulate the code needed to make that feature work (along with all of its dependencies). This allows external projects to declare a prerequisite not just on your distribution, but also a particular feature of that distribution.

At the moment it doesn't appear that any CPAN clients properly support optional_feature metadata and interactively prompt the user with the information therein. Therefore, prompting is added directly to Makefile.PL when the -relationship is requires. (It doesn't make much sense to prompt for recommends or suggests features, so prompting is omitted here.) You can also enable or disable this explicitly with the -prompt option. The prompt feature can only be used with Makefile.PL. If a Build.PL is detected in the build and =prompt is set, the build will fail.

As with any other interactive features, the installing user can bypass the prompts with PERL_MM_USE_DEFAULT=1. You may want to set this when running dzil build.

If set with a true value, the prerequisites are added to the distribution's metadata as recommended prerequisites (e.g. cpanminus will install recommendations with --with-recommends, even when running non-interactively).

If set with a true value, the prerequisites are added to the distribution's metadata as develop requires prerequisites (e.g. cpanminus will install recommendations with --with-develop, even when running non-interactively).