NAME

LCFG::Component::Plugin::Env - Set environment variables for LCFG component methods

VERSION

This documentation refers to LCFG::Component::Plugin::Env version 1.20.8

SYNOPSIS

use LCFG::Component::Plugin::Env;

my $plugin = LCFG::Component::Plugin::Env->new(
                component => $comp,
                params_list => ["FOO","BAR"],
                params      => { FOO => "Hello",
                                 BAR => "World", },
             );

$plugin->run();

DESCRIPTION

This is an LCFG component environment initialization module. It is sub-class of LCFG::Component::Plugin which can be used to set environment variables before an LCFG component method is called.

ATTRIBUTES

The base class has the following attributes:

component

This is a reference to the LCFG::Component object from which this plugin was loaded. This is useful for logging and gaining access to the various variables which control the logging levels (e.g. debug, verbose).

params_list

This is a list of names of parameters which were specified in the ngeneric resources.

If you call this method in a list context it returns a list otherwise it returns a reference to a list.

params

This is a reference to a hash of the names and values of the parameters which were specified in the ngeneric resources.

SUBROUTINES/METHODS

new(%attributes)

This creates a new plugin object, it takes the following attributes: component, params_list and params. See the list above for details. See the LCFG RESOURCES section below for details on how the ngeneric resources for a component are mapped into the params list.

The parameters are a list of names and values for environment variables which must be set prior to calling an LCFG component method.

param($key)

This is a convenience method which returns the value of the named parameter from the params hash.

run()

For each parameter this will set an environment variable of the same name with whatever value was specified. For example, with ng_plugin_params_env set to foo bar and ng_plugin_param_env_bar set to test2 and ng_plugin_param_env_foo set to test there will be an environment variable named foo set with the value test and a there will be an environment variable named bar set with the value test2.

DEPENDENCIES

This module is a sub-class of LCFG::Component::Plugin.

SEE ALSO

LCFG::Component

PLATFORMS

This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.

ScientificLinux6, EnterpriseLinux7, MacOSX

BUGS AND LIMITATIONS

Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.

AUTHOR

Stephen Quinney <squinney@inf.ed.ac.uk>, Paul Anderson <dcspaul@inf.ed.ac.uk>

LICENSE AND COPYRIGHT

Copyright (C) 2014-2015 University of Edinburgh. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.