METHODS

add_merged

The add_merged method takes a list (not arrayref) of plugin names, bundle names (with the @ prefix), or full module names (with the = prefix). This method combines add_plugins & add_bundle, and handles all of the payload merging for you. For example, if your bundle is passed the following options:

[@Bundle]
arg1 = blah
arg2 = foobar

Then it will pass the arg1/arg2 options to each of the plugins, IF they support the option. Specifically, it does a $class->can($arg) check. (Bundles are passed the entire payload set.) If arg1 exists for multiple plugins, it will pass the same option to all of them. If you need separate options, you should consider using the config_rename method.

It will also accept hashrefs anywhere in the list, which will replace the payload arguments while it processes. This is useful for changing the options "on-the-fly" as plugins get processed. The replacement is done in order, and the changes will persist until it reaches the end of the list, or receives another replacement.

If passed an arrayref, it will be directly passed to add_plugins. Useful for plugins that use BUILDARGS or some other non-standard configuration setup.

config_rename

This method is sort of like the config_slice method, but is more implicit than explicit. It starts off with the entire payload (cloned), and renames any hash pair that was passed:

my $hash = $self->config_rename(foobar_arg1 => 'arg1');

This example will change the argument foobar_arg1 to arg1. This is handy if you want to make a specific option for the plugin "Foobar" that doesn't clash with arg1 on plugin "Baz":

Any destination options are replaced. Also, if the destination value is undef (or non-true), the key will simply be deleted. Keep in mind that this is all a clone of the payload, so extra calls to this method will still start out with the original payload.

config_short_merge

Like config_rename, this is meant to be used within an add_merged block. It takes either a single plugin (scalar) or multiple ones (arrayref) as the first parameter, and a hashref of argument/value pairs as the second one. This will merge in your own argument/value pairs to the existing payload, pass the module list, and then pass the original payload back. For example:

Furthermore, the argument hash is expanded prior to the payload, so they can be overwritten by the payload. Think of this as default arguments to pass to the plugins.

ROLE PARAMETERS

mv_plugins

Certain configuration parameters are "multi-value" ones (or MVPs), and Config::MVP uses the mvp_multivalue_args sub in each class to identify which ones exist. Since you are trying to merge the configuration parameters of multiple plugins, you'll need to make sure your new plugin bundle identifies those same MVPs.

Because the INI reader is closer to the beginning of the DZ plugin process, it would be too late for add_merged to start adding in keys to your mvp_multivalue_args array. Thus, this role is parameterized with this single parameter, and comes with its own mvp_multivalue_args method. The syntax is a single arrayref of strings in the same prefix structure as add_merged. For example:

The above will identify these two plugins has having MVPs. When Config::MVP calls your mvp_multivalue_args sub (which is built into this role), it will load these two plugin classes and populate the contents of theirmvp_multivalue_args sub as a combined list to pass over to Config::MVP. In other words, as long as you identify all of the plugins that would have multiple values, your stuff "just works".

If you need to identify any extra parameters as MVPs (like your own custom MVPs or "dupe preventing" parameters that happen to be MVPs), you should consider combining mv_plugins with an after mvp_multivalue_args sub.

CAVEATS

Plugins that use non-standard payload methods will not be passed their options via add_merged, unless passed an arrayref to add_merged with an specific payload. The config_merge method will warn you of this, because it knows that you really want to use that argument. Others will not.

SUPPORT

Internet Relay Chat

You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help:

irc.perl.org

You can connect to the server at 'irc.perl.org' and talk to this person for help: SineSwiper.