-
-
19 Aug 2014 16:59:22 UTC
- Distribution: Env-Modulecmd
- Module version: 1.3
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (937 / 0 / 0)
- Kwalitee
Bus factor: 0- 63.11% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (12.7KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Env::Modulecmd - Interface to modulecmd from Perl
SYNOPSIS
# import bootstraps, executed at compile-time # explicit operations use Env::Modulecmd { load => 'foo/1.0', unload => ['bar/1.0', 'baz/1.0'], }; # implied loading use Env::Modulecmd qw(quux/1.0 quuux/1.0); # hybrid use Env::Modulecmd ('bazola/1.0', 'ztesch/1.0', { load => 'oogle/1.0', unload => [qw(foogle/1.0 boogle/1.0)], } ); # implicit functions, executed at run-time Env::Modulecmd::load (qw(fred/1.0 jim/1.0 sheila/barney/1.0)); Env::Modulecmd::unload ('corge/grault/1.0', 'flarp/1.0'); Env::Modulecmd::pippo ('pluto/paperino/1.0');
DESCRIPTION
Env::Modulecmd
provides an automated interface tomodulecmd
from Perl. The most straightforward use of Env::Modulecmd is for loading and unloading modules at compile time, although many other uses are provided.modulecmd Interface
In general,
Env::Modulecmd
works by making a system call to 'modulecmd perl [cmd] [module]
', under the assumption thatmodulecmd
is in your PATH. If you set the environment variablePERL_MODULECMD
,Env::Modulecmd
will use that value in place ofmodulecmd
. Ifmodulecmd
is not found, the shell will return an error and the script will die.Note: a default path to
modulecmd
, and a default setting forMODULEPATH
, can be built intoEnv::Modulecmd
when it's installed. See theREADME
file in the source tree for more information.Modules may, by convention, output warnings and informational messages;
modulecmd
directs these to standard error. Ifmodulecmd
outputs anything to standard error,Env::Modulecmd
inspects that output and attempts to determine whether it represents a fatal error. If the output begins with "ERROR:", or if it matchesmodulecmd
's typical error message format,Env::Modulecmd
fails. Otherwise,Env::Modulecmd
emits that output as a warning, but only if Perl warnings are enabled (-w
, oruse warnings
).If there were no fatal errors,
modulecmd
's output (if any) iseval
'ed. If theeval
operation fails,Env::Modulecmd
will fail.If you attempt to load a module which has already been loaded, or perform some other benign operation,
modulecmd
will generate neither output nor error; this condition is silently ignored.Compile-Time Usage
You can specify compile-time arguments to
Env::Modulecmd
on theuse
line, as follows:use Env::Modulecmd ('bazola/1.0', 'ztesch/1.0', { load => 'oogle/1.0', unload => [qw(foogle/1.0 boogle/1.0)], } );
Each argument is assumed to be either a scalar or a hashref. If it's a scalar,
Env::Modulecmd
assumes it's the name of a module you want to load. If it's a hashref, then each key is the name of a modulecmd operation (ie:load
,unload
) and each value is either a scalar (operate on one module) or an arrayref (operate on several modules).In the example given above,
bazola/1.0
andztesch/1.0
will be loaded by implicit usage.oogle/1.0
will be loaded explicitly, andfoogle/1.0
andboogle/1.0
will be unloaded.Run-Time Usage
Additional module operations can be performed at run-time by using implicit functions. For example:
Env::Modulecmd::load (qw(fred/1.0 jim/1.0 sheila/barney/1.0)); Env::Modulecmd::unload ('corge/grault/1.0', 'flarp/1.0'); Env::Modulecmd::pippo ('pluto/paperino/1.0');
Each function name is passed as a command name to
modulecmd
, and each call can include one or more modules to be processed. The example above will generate the following six calls tomodulecmd
:modulecmd perl load fred/1.0 modulecmd perl load jim/1.0 modulecmd perl load sheila/barney/1.0 modulecmd perl unload corge/grault/1.0 modulecmd perl unload flarp/1.0 modulecmd perl pippo pluto/paperino/1.0
SEE ALSO
For more information about modules, see the module(1) manpage or http://www.modules.org.
BUGS
If you find any bugs, or if you have any suggestions for improvement, please contact the author.
AUTHOR
Ron Isaacson <Ron.Isaacson@morganstanley.com>
COPYRIGHT
Copyright (c) 2001-2014, Morgan Stanley.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
A copy of the GNU General Public License was distributed with this program in a file called LICENSE. For additional copies, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Module Install Instructions
To install Env::Modulecmd, copy and paste the appropriate command in to your terminal.
cpanm Env::Modulecmd
perl -MCPAN -e shell install Env::Modulecmd
For more information on module installation, please visit the detailed CPAN module installation guide.