sorry i can't help. someone who is more versed in the details of tcl variable
scopes might be able to fix the problem. or someone can get rid of the g_mode
variable, and replace it with a mechanism that implements dynamic scoping.
Mark Lakata, Staff Engineer 1225 Charleston Road voice 650-567-5170
MIPS Technologies Mountain View CA 94043 fax 650-567-5002
On Fri, 3 Oct 2003, Keith Richling wrote:
> Yes, we do use/need tcl packages in our existing modulefiles. We also
> do call module commands from within these packages. The way that our
> packages are architected would make if very difficult to not call module
> commands. If we cannot use packages I will need to keep using the C
> implementation.
>
> Keith
>
> Mark Lakata wrote:
> >
> > Yes, this is a problem. I wasn't anticipating the use of packages in the
> > modulefiles. It assumes that the modulefiles are only 1 deep. The "mode"
> > variable it complains about is taken from the scope of the calling parent of
> > the module. If you add another layer with the packages, the scope is wrong.
> >
> > I can't think of an easy way to fix this. There was a reason I did it this way,
> > since it allows you to "change" the mode since it is dynamically scoped (sort
> > of like perls "local"). For instance, you could have module "a" have the line
> > "module unload b" inside. When you load module a, module b gets unloaded. So
> > the mode changes from "load" to "unload", but after module b is unloaded it
> > reverts back to "load". By dynamically scoping (with up_var), I can get away
> > with this. I can't use globals for this.
> >
> > Do you really need to use packages? If you want to use the package, I suggest
> > that you don't use any module commands in the package, and do all the
> > setenv'ing in the main module. You can use function return values or global
> > values to communicate any settings back to the main module, just don't use
> > 'setenv' in the sub package.
> >
> > Mark Lakata, Staff Engineer 1225 Charleston Road voice 650-567-5170
> > MIPS Technologies Mountain View CA 94043 fax 650-567-5002
> >
> > On Fri, 3 Oct 2003, Keith Richling wrote:
> >
> > > I am using the tcl implementation of modules checked out from cvs with
> > > bash version 2.05b.
> > >
> > > I have a case where setenv is failing with the following error
> > > message:
> > >
> > > ERROR: module: module load test failed. can't read "mode": no such
> > > variable
> > >
> > > I have attached three files that can be used to reproduce this
> > > problem. Place these files in <some-directory> and then run the
> > > following commands:
> > >
> > > md use <some-directory>
> > > md add test
> > >
> > > The failure is occurring on the following line in the file
> > > test_pkg.tcl:
> > >
> > > setenv TEST_PKG TRUE
> > >
> > > --
> > > Keith Richling | Agilent Technologies
> > > Email: kei...@ag... | MS/72
> > > Voice: (970) 288-7903 | 4380 Ziegler Road
> > > Fax: (970) 288-6580 | Fort Collins, CO 80525-9790
>
|