PXP::Config

PXP::Config is a Perl module for PXP configuration.
Download

PXP::Config Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • PXP::Config Team
  • Publisher web site:
  • http://search.cpan.org/~dbarth/PXP-0.1.2/lib/PXP/Config.pm

PXP::Config Tags


PXP::Config Description

PXP::Config is a Perl module for PXP configuration. 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() method2) the sophisticated way - use it in other cases:create a new package in a file MyConfig/PLUGIN_NAME.pm under your plugin directoryin 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: · Perl


PXP::Config Related Software