The Perl Advent Calendar needs more articles for 2022. Submit your idea today!


PXP::PluginRegistry - Registry of plugins for PXP


  use PXP::PluginRegistry;
  PXP::init(dir => './plugins', default => 'all', load => [], noload => []);
  my $plugin   = PXP::PluginRegistry::getExtension(ref($self))->plugin();
  my $extpt = PXP::PluginRegistry::getExtensionPoint('PXP::StaticResourcesHandler');


The PluginRegistry groups together a set of plugins, extension points and extensions for the running system.


The PluginRegistry manages plugins, extension points and extensions.

The PluginRegistry takes care of loading the plugins from file, loading classes and Perl modules and, optionnaly, running 'startup' sub-routines as each plugin is loaded in the system.


Initialize the plugin registry. Note: only one instance of PluginRegistry is supported (singleton pattern).


Return a hash containing all registered plugins.


Return a plugin referenced by its id, or undef if no such plugin exists.

Warning : a plugin id can be different from its actual object class, as declared in plugin.xml


Load all plugins present in the directory.

This is usually called once by by PXP::init. Plugin developpers can call this function to load plugins installed outside of the system default directory ('plugins' at the root of the PXP home directory).

See below for details about the loading process.


Search the registry for an ExtensionPoint and return it, based on its id.


Return the internal XML node describing the extension in the plugin.xml file.

This is mostly used by plugin developpers to get access to the XML config.


Search the registry for an Extension and return it, based on its id.

This returns the internal extension descriptor object, ie an PXP::Extension object, not the real extension See the code for details of the private API.

Loading process

First, the PluginRegistry calls loadPluginFromDirectory to load all the plugins installed in the system directory (usually called 'plugins' inside the PXP hierarchy). The loader calculates the dependencies so that plugin can resolve symbols.

For each plugin, extension points are instantiated and registered into the global registry.

Then, extension _definitions_ are handed to the extension points to be registered. Extension points choose wether to instantiate a particular objet for each of their extensions.

Last, the PluginRegistry calls the 'startup' routine of each plugin that declared a specific class (class="" attribute inside the plugin.xml header).

An error during plugin load stops the process for a whole plugin dependency branch, but plugin startup is still called for plugins that have already been loaded.


See PXP::ExtensionPoint, PXP::Extension for details about the concepts


1 POD Error

The following errors were encountered while parsing the POD:

Around line 69:

'=item' outside of any '=over'