CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Avoiding shell escapes

 



Haplo2
New User

Mar 6, 2002, 1:30 AM

Post #1 of 2 (400 views)
Avoiding shell escapes Can't Post

I'm using Perl v5.6.1 under WinNt 4.0 in a Dos box.
Inside the Perl script, I need to call a batch file (<name>.bat), which sets all kinds of things - what it actually does is beyond my scope. I need those settings to continue with my own Perl script.

My problem: this batch file is invoked in a different shell, i.e. all the environment settings are copied, and using this copy, the batch file is executed. It is also on that copy that changes are made. When the program ends, the copy is destroyed, leaving Perl with an unmodified environment, which is, in this case, highly indesirable.

Is there any way to circumvent this, I mean, to let the batch file make the changes on the same environment as my Perl script uses?


yapp
User

Mar 6, 2002, 6:18 AM

Post #2 of 2 (392 views)
Re: [Haplo2] Avoiding shell escapes [In reply to] Can't Post

I don't know. Any changes to the environment in child processes, will only be visible in that process (and it's child processes).

However, do you really need that batch file? Perl has been introduced for many reasons, also to replace UNIX shell scripts. Windows batch files are far more limited, so I expect you can rewrite that in Perl aswell.

So please post that batch file code. I can't help you with anything else here.

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives