Your skill will accomplish
what the force of many cannot
accessing an environment variable dynamicallyby JennieInMI (Acolyte)
|on Jan 01, 2013 at 18:47 UTC||Need Help??|
JennieInMI has asked for the
wisdom of the Perl Monks concerning the following question:
I'm on a PC running Windows 7 and I am using ActivePerl. Once I work out the bugs the script this sub lives in will run on a Windows Server 2008 SP1 machine. Not sure which of that info might be needed/helpful, but there it is!
I have read about the ENV module, but I don't think it does what I need it to. I don't want the env variables in existence when the script is first run, I would like that errorlevel env var that is set (hopefully) when the script I call from inside my Perl script is run. To that end, I have a couple of questions.
1. If I call another script (a BeyondCompare3 script in this case) with a system call in backticks from a Perl script, is the DOS errorlevel environment variable set? I believe that's what I understand from all the reading I've been doing on it, but I wondered if anyone could confirm that.
2. If it is set, is my $errorLevel = %ERRORLEVEL; the proper way to access that value in my Perl script?
This is what my mock-up sub looks like so far:
I know it's pretty obvious from looking at it, but the goal is to verify that the contents of the two folders are identical. Not so obvious probably is that nothing else needs to match - date modified, permissions, etc - only the contents of the folders need to be identical. I've run my script a few times, but I don't think I'm getting what I am looking for. For example, the installers in the deliveries and caching folder don't match today and here is the result I get in the console window when I run my Perl script $errorLevel is 0 I know that the errorlevel is being set in response to that command running because when I intentionally mess up a folder name I do get a different code.
I've put a lot of work into this at this point so I'd like to make it work and would really like advice to that end, but I am also open to hearing about Perlish way to accomplish this folder comparison. It has to be heavy duty though because these folders are huge.
Thank you in advance for any advice. So grateful to have you all to ask.
I realize I didn't make it clear that I have looked up Perlish way to accomplish this and found this link at StackOverflow, but you need to download modules to make it work and I wasn't sure how safe that was. I'm on my work computer and so I can't be cavalier about naughty things getting in. Sorry if the StackOverflow reference is taboo. Just didn't want you all to think I came expecting you to do all the work for me.