[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: Misterious Behavior of WML calling WML

On Thu, Sep 03, 1998, Oliver Paukstadt wrote:

> > foreach $key (keys %ENV) {
> >     delete $ENV{$key} if $key ne "PATH";
> > }
> Yeah, that deletes the ENVIRONMENT of perl, but you  have to start the WML
> from that instance of perl.
> that would make a call like:(maybe not fully correct quoted)
> system("perl -e 'foreach (keys \%ENV){delete \$ENV{\$_} if /^PATH\$/;}
> 	system(\"env > test.env\");'");
> system calls perl calls system, but this doesn't work.
> The Problem is, that the 1st wml or eperl needs the Environment and
> only the subcalls need a clean environment.
> For this level,
> system("perl -e '$ENV=(PATH => $ENV{PATH});system(\"env > test.env\");'
> should work, too.
> system forks a new shell with new initalised environemnt-variables, so the
> former deletion doesn't have any effect. backticks are not working, too.

Hmmmm... works fine for me (not the % instead of the $):

| rse@en1:/u/rse
| :> perl -e '%ENV=(PATH => $ENV{PATH}); system("./x");'
| PATH=/u/rse/bin:/sw/bin:/usr/local/bin:/usr/local/sbin:/usr/bin
| rse@en1:/u/rse
| :> cat x
| #!/bin/sh
| env
| rse@en1:/u/rse
| :>

> So, you must delete the Environment-Variables on the same shell-levels
> were you call the sub-WML.

No, it the environment is inherited, so it's ok when you delete %ENV and then
call the child. Hmmm... interesting that it doesn't work for you.

> Maybe RSE can list all the environment-variables.
> The envar I know are ^SCRIPT.* from WML in common and 
> ^EPERL.* from the eperl-Pass.

Which variables do you exactly mean? Environment variables which are needed by
WML or ePerl or those who are generated by WML or ePerl? Or do you mean the
WML-internal variables you can interprolat with $(XXX) and <:=$XXX:>?

                                       Ralf S. Engelschall
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com