[EMAIL PROTECTED] wrote:

> Dear Bill and the others,
> 
> You can't set $foo_token (or $foo_token_dir ) to $ENV{ FOO_TOKEN}. 
> The value ot the variable has to be "%%FOO_TOKEN%_DIR%".

What you set in the BAT file was :
        FOO_TOKEN=BAR
        BAR_DIR=c:\bar

So the only ENV vrbls available are FOO_TOKEN and BAR.
The %'s are used to indicate to the shell to interpolate.  eg:

%FOO_TOKEN% is interpolated to the value of 'FOO_TOKEN' env vrbl
which is 'BAR' so 'CALL SET %FOO_TOKEN%_DIR=c:\bar' sets 'BAR_DIR'
to 'C:\bar'

> It's a little bit complecated, but I think I have to explain it. 
> 
> I set  CALL SET %FOO_TOKEN%_DIR=c:bar in a cmd-file to declare 
> directories I will use in my script. All directories are decleared in
> that way. So if there are changing of the structure of your directory, you 
> just
> change it here.

Fine so you just set BAR_DIR to c:\bar - no problem so far

> You may ask, why don't you use a fix prefix like SET FOO_DIR=c:bar?
> That's because, I want to be flexible. If someone has already used "FOO_DIR"
> in his environment, you have a problem. So I want to be able to change 
> the prefix in an easy way. 

No problem with the indirection.

> In the script, I run the cmd-file, so that I have all the directories in an 
> environment variable. In real life, it's not that easy to get them in the 
> perl hash "%ENV". But this should not be a part of the discussion.

Sure it is - whatever is in the output of set will also be in %ENV if
you immediately run a perl script.

> I have another file, which is an ini-file type. There is defined, what really
> happenes in the script. So if I want to use the directory "c:bar", I don't 
> want
> to write  "c:bar", but  "%%FOO_TOKEN%_DIR%" in the way I declared it in
> the cmd-file. Because I don't want to change the ini-file, when there are 
> changes in the structure of the directory. I have a lot of ini-files and 
> I want that overview of the used directories in the cmd-file.

Except you won't ever see %%FOO_TOKEN%_DIR% when you type set, what
you'll see is the interpolated result 'BAR_DIR=C:\bar' and 'FOO_TOKEN=BAR'

> So I read in the ini-file and it has the value "%%FOO_TOKEN%_DIR%".
> Now I want the other way back to get the name of the directory, in that 
> case "c:bar". 

Who's reading the ini file - perl or a bat script ?  If Perl is reading
it, it's not gonna work unless the script shells off the commands you
want to do next.  It the bat script does it, it would firsst have to break
up the two levels of indirection and do them one at a time as you did:

        SET FOO_TOKEN=BAR
        CALL SET %FOO_TOKEN%_DIR=c:\bar
which again yields:
        FOO_TOKEN=BAR
        BAR_DIR=C:\bar

> So for the group, I made it that easy. I hope you understand, what I'm
> trying to do.

I think we do - but I don't think you do.  ;)  You need to 'splain
more about how you get from ini file to scrip/bat file.

> I do not understand, what you mean with "always add the %'s back in"?

That's because you still haven't properly explained your problem properly.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to