"Andreas J. Koenig" wrote:
>
> >>>>> On Thu, 31 May 2001 11:17:01 -0400, Ron Isaacson
><[EMAIL PROTECTED]> said:
>
> > I have one module ready for near-immediate release: Env::Module, a Perl
> > interface to modulecmd, to automate loading of modulefiles from Perl
> > scripts.
>
> Can you please use the form "Apply for namespace..." on PAUSE for
> registering? And please try to describe the purpose of the module a
> bit more so that an innocent reader gets the intent--I do not get it.
Hi Andreas --
Thanks for the quick reply! It seems the Env:: namespace is already in
use under Chapter 4 (user DSB has Env::Path). Env::Module is similar in
theory, although it works with modulefiles. By definition, from
www.modules.org:
The Modules package provides for the dynamic modification of a user's
environment via modulefiles.
Each modulefile contains the information needed to configure the shell
for an application. Once the Modules package is initialized, the
environment can be modified on a per-module basis using the module
command which interprets modulefiles. Typically modulefiles instruct
the module command to alter or set shell environment variables such as
PATH, MANPATH, etc. modulefiles may be shared by many users on a
system and users may have their own collection to supplement or
replace the shared modulefiles
Here's an example: let's say you have several releases of xemacs
installed, and you want an easy way to choose your favorite release.
Here's a modulefile that might be called "xemacs/21.1.14":
#%Module
if { [file isdirectory /usr/xemacs/21.1.14/bin] } {
prepend-path PATH /usr/xemacs/21.1.14/bin
}
if { [file isdirectory /usr/xemacs/21.1.14/man] } {
prepend-path MANPATH /usr/xemacs/21.1.14/man
}
Then there's a binary, called modulecmd, which outputs eval'able code in
a variety of languages. If your shell is ksh, you might type: "eval
`modulecmd ksh load xemacs/21.1.14`" to properly configure your
environment.
Now, modulecmd supports perl as well. If I issue the command "modulecmd
perl load xemacs/21.1.14", given the above modulefile, it will spit out
something like this (well not exactly, but here's a simplified version):
$ENV{'PATH'} = "/usr/xemacs/21.1.14/bin:" . $ENV{'PATH'};
$ENV{'MANPATH'} = "/usr/xemacs/21.1.14/man:" . $ENV{'MANPATH'};
That's where Env::Module comes in. You say Env::Module::load
('xemacs/21.1.14') and it will run modulecmd and eval the output. (It
can also unload modules and do some other fancy stuff, like check for
errors.)
Obviously, this will only be useful to people who use modulecmd and have
some modulefiles installed. Can you recommend a chapter for this, and a
good succinct way to describe it? :-)
--
Ron Isaacson
Morgan Stanley
[EMAIL PROTECTED] / (718) 754-2345