Dear Bill and the others,

> > --- begin ---
> > SET FOO_TOKEN=BAR
> > CALL SET %FOO_TOKEN%_DIR=c:bar
> 
> CALL SET %FOO_TOKEN%_DIR=c:bar                # added 

yes that was my fault. I don't know, how it got there, because I copied the 
code via 
clipboard. Shit happens... . ;-)

> > --- beginn ---
> > use strict;
> > use warnings;
> > 
> > my $foo_token_dir   = "%%FOO_TOKEN%_DIR%";
> > my $foo_token_value = "";
> > 
> > $foo_token_value = $ENV{ $foo_token_dir };
> > #$foo_token_value = $ENV{ BAR_DIR };
> > 
> > print "foo_token_dir:   " . $foo_token_dir   . "n";
> > print "foo_token_value: " . $foo_token_value . "n";
> > --- end ---
> 
> I don't really follow what you're doing, but I would just go with :
> my $foo_token = $ENV{FOO_TOKEN};

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%".
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.

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. 

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.

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.

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". 

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

The rest of your script does not help me. 

> print "foo_token: $foo_tokenn";
> my $foo_token_dir = $ENV{"${foo_token}_DIR"};
> print "foo_token_dir: $foo_token_dirn";

> If that's what you really want.  I don't know why you would print out %'s
> unless you were redirecting to another .bat file - in which case you could
> always add the %'s back in.

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

Thanks
Karl-Heinz
 










_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to