PXP::Config 0.1.2
PXP::Config is a Perl module for PXP configuration. SYNOPSIS # do this only once at server initialization: PXP::Config::init(f
|
|||||||||||||||||||
PXP::Config is a Perl module for PXP configuration.
SYNOPSIS
# do this only once at server initialization:
PXP::Config::init(file=>$finename);
# then from anywhere:
my $global_configuration_hash = PXP::Config::getGlobal();
# only from a plugin class:
my $plugin_configuration_hash = PXP::Config::get();
PXP::Config is a PXP component which provides a unified and simplified API for the PXP server and PXP plugins to read and store there configuration.
PXP::Config uses the XML::Simple module to access a centralized XML configuration file. This file (/opt/etc/imc.xml by default) contains root element named imc which has a global child for the PXP server configuration and a plugins child which has itself a child per plugin configuration (the child name must be the plugin name for this class to automatically retrieve a plugin configuration.
As plugins configurations are retrived by plugin name in a centralized location, the only thing a plugin has to do in order to get its configuration is to call the PXP::Config::get() method which returns a hash convertion of the plugin XML configuration.
Configuring plugins can be made in two manners:
1) the simple way - use it when you don't need to update the configuration from the application itself and when your plugin configuration has a very simple structure:
simply add a tag with the name of your plugin in the etc/imc.xml file, the plugin configuration can then be accessed as a has by calling the PXP::Config::get() method
2) the sophisticated way - use it in other cases:
create a new package in a file MyConfig/PLUGIN_NAME.pm under your plugin directory
in this file, define a package that inherits from PXP::MyConfig class and which overrode the config, loadFile and synchro methods (see plugins/LogViewer/MyConfig/LogViewer.pm for an example)
edit your plugin.xml and add your new package as an extension to the PXP::MyConfig extension point:
< extension
id="MyConfig::LogViewer"
name="Plugin configuration"
version="0.1"
point="IMC::MyConfig"/ >
< file value='/tmp/imc.xml'/ >
< /extension >
You can ommit the file tag, configuration file will then default to the main configuration file (the one passed to the server with the -c switch or etc/imc.xml by default).
See the PXP::Config and PXP::MyConfig APIs for using configuration inside plugins.
Requirements:
tags
Download PXP::Config 0.1.2
Authors software
|
|
Similar software
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other software in this category
|
|
|
|
|
|
|
|
|
|
Featured Software
jEdit 4.3 pre8
jEdit is an Open Source text editor written in Java
Opera 9.02
Surf the Internet in a safer, faster, and easier way with Opera browser
GNU Aspell 0.60.4
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell
- Communications
- Database
- Desktop Environment
- Games
- Internet
- Multimedia
- Office
- Programming
- Science and Engineering
- System
- Text Editing&Processing
