NAME

MooX::PluginRoles::Base - find and apply plugin roles

SYNOPSIS

# do not use directly

DESCRIPTION

MooX::PluginRoles::Base implements the core PluginRoles logic. It is used by MooX::PluginRoles, and is not expected to be used directly.

Required Parameters

base_class

Name of the package that is calling MooX::PluginRoles

classes

ArrayRef of classes within the base namespace that can be extended

plugin_dir

Directory to search for plugins

role_dir

Directory within plugin_dir to search for roles

Attributes

class_plugin_roles

Roles provided for each class by each available plugin, hashed by extendable class and plugin

Methods

add_client

Add the given client to the list of clients using this base package.

Parameters:

pkg

Name of client package

file

File of client package

line

Line number where client package included base class

plugins

ArrayRef of plugins to use

Internals

Module::Pluggable::Object is used to search the plugin role directories.

An anonymous class is created for each base class with each unique set of plugins, using Eval::Closure.

All clients are tracked, with their specified set of plugins, so that the proper anonymous classes can be used when the base class constructors are called within each client's namespace.

The base class constructors are wrapped by creating an anonymous role wrapping new method, using the caller's namespace to determine the appropriate anonymous class to construct.

AUTHOR

Noel Maddy <zhtwnpanta@gmail.com>

COPYRIGHT

Copyright 2016 Noel Maddy

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.