NAME

Padre::PluginManager - Padre plugin manager

DESCRIPTION

The PluginManager class contains logic for locating and loading Padre plugins, as well as providing part of the interface to plugin writers.

METHODS

new

The constructor returns a new Padre::PluginManager object, but you should normally access it via the main Padre object:

my $manager = Padre->ide->plugin_manager;

First argument should be a Padre object.

plugin_dir

Returns the user plugin directory (below the Padre configuration directory). This directory was added to the @INC module search path and may contain packaged plugins as PAR files.

plugins

Returns a hash (reference) of plugin names associated with a plugin manager internal structure describing the state of the plugin in the current editor. The contents are somewhat in flux and considered mostly PRIVATE, but the following will likely stay:

module

Full name of the module that implements the plugin, i.e. Padre::Plugin::Foo.

status

The status of the plugin. failed indicates failure while trying to load the module. new indicates it was detected as a new plugin. loaded indicates that the module has been successfully loaded, and disabled indicates that it isn't being used as it's been disabled in the configuration.

Note that this concerns the status of the module in memory. Whether or not to load the plugin is kept in the configuration instead to make it persistent. To check whether a given plugin is enabled, do this:

if (Padre->config->{plugins}{$plugin_name}{enabled}) {...}
object

The actual Padre::Plugin::Foo object. Availability depends on the status, of course. The other keys are kept separate since the plugin object is the sole domain of the plugin writer. We don't want them to wreak havoc on our meta data, now do we?

This hash is only populated after load_plugins() was called.

plugin_config

Given a plugin name or namespace, returns a hash reference which corresponds to the configuration section in the Padre YAML configuration of that plugin. Any modifications of that hash reference will, on normal exit, be written to the configuration file.

If the plugin name is omitted and this method is called from a plugin namespace, the plugin name is determine automatically.

load_plugins

Scans for new plugins in the user plugin directory, in @INC, and in .par files in the user plugin directory.

Loads any given module only once, i.e. does not refresh if the plugin has changed while Padre was running.

load_plugin

Given a plugin name such as Foo (the part after Padre::Plugin), load the corresponding module, enable the plugin and update the Plugins menu, etc.

unload_plugin

Given a plugin name such as Foo (the part after Padre::Plugin), DISable the plugin, UNload the corresponding module, and update the Plugins menu, etc.

reload_plugins

For all registered plugins, unload them if they were loaded and then reload them.

reload_plugin

Reload a single plugin whose name (without Padre::Plugin::) is passed in as first argument.

failed

Returns the plugin names (without Padre::Plugin:: prefixed) of all plugins that the editor attempted to load but failed. Note that after a failed attempt, the plugin is usually disabled in the configuration and not loaded again when the editor is restarted.

SEE ALSO

Padre, Padre::Config

PAR for more on the plugin system.

COPYRIGHT

Copyright 2008 Gabor Szabo.

LICENSE

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 412:

Unterminated C<...> sequence